Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1521744
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] thermal/powerclamp: use PF_IDLE in injection kthread |
| Date | 2016-11-14 16:20 +0100 |
| Message-ID | <sDrd7-eg-11@gated-at.bofh.it> (permalink) |
| References | <sBGpX-2Wm-11@gated-at.bofh.it> <sBGpY-2Wm-59@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 09, 2016 at 11:05:12AM -0800, Jacob Pan wrote:
> +static enum hrtimer_restart idle_inject_timer_fn(struct hrtimer *hrtimer)
> +{
> + set_tsk_need_resched(current);
So drivers really should not use this, which is why I had that in
play_idle().
> + return HRTIMER_NORESTART;
> +}
> +
> static void clamp_idle_injection_func(struct kthread_work *work)
> {
> struct powerclamp_worker_data *w_data;
> - unsigned long target_jiffies;
> + unsigned long end_time;
> + unsigned int duration_ms;
>
> w_data = container_of(work, struct powerclamp_worker_data,
> idle_injection_work.work);
>
> + hrtimer_init(&w_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
> + w_data->timer.function = idle_inject_timer_fn;
> +
> /*
> * only elected controlling cpu can collect stats and update
> * control parameters.
> @@ -453,31 +459,17 @@ static void clamp_idle_injection_func(struct kthread_work *work)
> if (should_skip)
> goto balance;
>
> + end_time = jiffies + w_data->duration_jiffies;
> + duration_ms = jiffies_to_msecs(w_data->duration_jiffies);
> + hrtimer_start(&w_data->timer, ms_to_ktime(duration_ms),
> + HRTIMER_MODE_REL_PINNED);
> +
> + cpuidle_use_deepest_state(true);
> + while (time_after(end_time, jiffies))
> + play_idle();
Why that loop?
> + cpuidle_use_deepest_state(false);
> +
> + hrtimer_cancel(&w_data->timer);
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH 3/3] thermal/powerclamp: use PF_IDLE in injection kthread Peter Zijlstra <peterz@infradead.org> - 2016-11-14 16:20 +0100
csiph-web