[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKohpo=6xeESG2DqET4WQFciHN6sX5Z7Jz9JbE6RC00BsV3bdA@mail.gmail.com>
Date: Tue, 2 Apr 2013 21:22:15 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Nathan Zimmer <nzimmer@....com>
Cc: rjw@...k.pl, cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 1/2] cpufreq: split the cpufreq_driver_lock and use the rcu
On 2 April 2013 21:10, Nathan Zimmer <nzimmer@....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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists