Re: [RFC][PATCH] sched: Kick bandwidth timer immediately on start up
From: Peter Zijlstra
Date: Tue Feb 23 2016 - 09:29:13 EST
On Tue, Feb 16, 2016 at 06:37:46PM -0500, Steven Rostedt wrote:
> Index: linux-trace.git/kernel/sched/rt.c
> ===================================================================
> --- linux-trace.git.orig/kernel/sched/rt.c 2016-02-16 16:31:12.041035819 -0500
> +++ linux-trace.git/kernel/sched/rt.c 2016-02-16 16:31:19.997905282 -0500
> @@ -58,7 +58,15 @@ static void start_rt_bandwidth(struct rt
> raw_spin_lock(&rt_b->rt_runtime_lock);
> if (!rt_b->rt_period_active) {
> rt_b->rt_period_active = 1;
> - hrtimer_forward_now(&rt_b->rt_period_timer, rt_b->rt_period);
> + /*
> + * SCHED_DEADLINE updates the bandwidth, as a run away
> + * RT task with a DL task could hog a CPU. But DL does
> + * not reset the period. If a deadline task was running
> + * without an RT task running, it can cause RT tasks to
> + * throttle when they start up. Kick the timer right away
> + * to update the period.
> + */
> + hrtimer_forward_now(&rt_b->rt_period_timer, ns_to_ktime(0));
That's a bit icky, but yeah, probably the best we can do without making
a giant mess of things..
> hrtimer_start_expires(&rt_b->rt_period_timer, HRTIMER_MODE_ABS_PINNED);
> }
> raw_spin_unlock(&rt_b->rt_runtime_lock);