Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1521744 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2016-11-14 16:20 +0100 |
| Last post | 2016-11-14 16:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 3/3] thermal/powerclamp: use PF_IDLE in injection kthread Peter Zijlstra <peterz@infradead.org> - 2016-11-14 16:20 +0100
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-11-14 16:20 +0100 |
| Subject | Re: [PATCH 3/3] thermal/powerclamp: use PF_IDLE in injection kthread |
| Message-ID | <sDrd7-eg-11@gated-at.bofh.it> |
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 top | Article view | linux.kernel
csiph-web