lkml.org 
[lkml]   [2013]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v6 1/2] cpufreq: split the cpufreq_driver_lock and use the rcu
From
On 2 April 2013 21:10, Nathan Zimmer <nzimmer@sgi.com> wrote:
> My concern is in the cpufreq_register_driver. Since we are only to set the
> pointer when it is null we have have to hold the lock over both operations.
>
> int cpufreq_register_driver(struct cpufreq_driver *driver_data)
> {
> ...
> spin_lock_irqsave(&cpufreq_driver_lock, flags);
> if (rcu_access_pointer(cpufreq_driver)) {
> spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
> return -EBUSY;
> }
> rcu_assign_pointer(cpufreq_driver, driver_data);
> spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
> synchronize_rcu();
> ...
> }

How will the lock help you here?? Lock is useful only when somebody
else who want to access it is waiting on the lock and we are updating
the pointer.

Because all other accesses to cpufreq_driver don't have any lock, this
lock is just a waste of time.


\
 
 \ /
  Last update: 2013-04-02 19:41    [W:0.119 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site