Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1284431
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers |
| Date | 2015-12-05 02:50 +0100 |
| Message-ID | <qCa94-289-1@gated-at.bofh.it> (permalink) |
| References | <qBtnr-8mi-3@gated-at.bofh.it> <qBMJr-3WG-1@gated-at.bofh.it> <qBRSN-7t4-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Friday, December 04, 2015 11:41:01 AM Viresh Kumar wrote: > On 04-12-15, 02:18, Rafael J. Wysocki wrote: > > > + shared->skip_work--; > > > > Is there any reason for incrementing and decrementing this instead of setting > > it to either 0 or 1 (or maybe either 'true' or 'false' for that matter)? > > > > If my reading of the patch is correct, it can only be either 0 or 1 anyway, right? > > No. It can be 0, 1 or 2. > > If the timer handler is running on any CPU, we increment skip_work, so > its value is 1. If at the same time, we try to stop the governor, we > increment it again and its value is 2 now. > > Once timer-handler finishes, it decrements it and its value become 1. > Which guarantees that no other timer handler starts executing at this > point of time and we can safely do gov_cancel_timers(). And once we > are sure that we don't have any work/timer left, we make it 0 (as we > aren't sure of the current value, which can be 0 (if the timer handler > wasn't running when we stopped the governor) or 1 (if the timer > handler was running while stopping the governor)). > > Hope this clarifies it. Well, almost, but not quite yet, because now the question is what prevents gov_cancel_work() from racing with dbs_work_handler(). If you can guarantee that they'll never run in parallel with each other, you probably don't need the whole counter dance. Otherwise, dbs_work_handler() should decrement the counter under the spinlock after all I suppose. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-03 05:10 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-04 01:50 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-04 07:20 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-05 02:50 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-05 05:20 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-07 02:00 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-07 09:00 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-07 23:20 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-07 23:50 +0100
[PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 01:20 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 08:00 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 14:10 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 14:40 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 14:50 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 15:00 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 15:10 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 16:00 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 17:20 +0100
Re: [PATCH][experimantal] cpufreq: governor: Use an atomic variable for synchronization Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 17:40 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 07:50 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 08:00 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 13:50 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-08 14:40 +0100
Re: [PATCH V2 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-08 14:40 +0100
[PATCH V3 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-04 07:20 +0100
[PATCH V4 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-09 03:10 +0100
Re: [PATCH V4 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-09 22:40 +0100
Re: [PATCH V4 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-10 03:40 +0100
Re: [PATCH V4 5/6] cpufreq: governor: replace per-cpu delayed work with timers "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-12-10 22:50 +0100
Re: [PATCH V4 5/6] cpufreq: governor: replace per-cpu delayed work with timers Viresh Kumar <viresh.kumar@linaro.org> - 2015-12-11 02:50 +0100
csiph-web