Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1312464
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 18/19] cpufreq: remove transition_lock |
| Date | 2016-01-19 20:30 +0100 |
| Message-ID | <qSK8y-3LS-17@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <qSF8S-w0-13@gated-at.bofh.it> <qSFLB-Lg-29@gated-at.bofh.it> <qSGxY-1lu-29@gated-at.bofh.it> <qSH12-1Nb-57@gated-at.bofh.it> <qSJYS-3Il-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Jan 19, 2016 at 08:17:34PM +0100, Peter Zijlstra wrote:
> On Tue, Jan 19, 2016 at 04:01:55PM +0000, Juri Lelli wrote:
> > Right, read path is fast, but write path still requires some sort of
> > locking (malloc, copy and update). So, I'm wondering if this still pays
> > off for a structure that gets written a lot.
>
> No, not at all.
>
> struct cpufreq_driver *driver;
>
> void sched_util_change(unsigned int util)
> {
> struct my_per_cpu_data *foo;
>
> rcu_read_lock();
That should obviously be:
d = rcu_dereference(driver);
if (d) {
foo = __this_cpu_ptr(d->data);
> if (abs(util - foo->last_util) > 10) {
> foo->last_util = util;
> foo->set_util(util);
> }
> }
> rcu_read_unlock();
> }
>
>
> struct cpufreq_driver *cpufreq_flip_driver(struct cpufreq_driver *new_driver)
> {
> struct cpufreq_driver *old_driver;
>
> mutex_lock(&cpufreq_driver_lock);
> old_driver = driver;
> rcu_assign_driver(driver, new_driver);
> if (old_driver)
> synchronize_rcu();
> mutex_unlock(&cpufreq_driver_lock);
>
> return old_driver;
> }
>
>
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-19 15:10 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Juri Lelli <juri.lelli@arm.com> - 2016-01-19 15:50 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-19 16:40 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Juri Lelli <juri.lelli@arm.com> - 2016-01-19 17:10 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-19 20:20 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-19 20:30 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-01-19 23:00 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-20 18:10 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-20 23:20 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Peter Zijlstra <peterz@infradead.org> - 2016-01-20 23:40 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock "Rafael J. Wysocki" <rafael@kernel.org> - 2016-01-21 00:40 +0100
Re: [RFC PATCH 18/19] cpufreq: remove transition_lock Juri Lelli <juri.lelli@arm.com> - 2016-01-20 14:00 +0100
csiph-web