From: Mike Galbraith <efault@gmx.de>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>, Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [patch] sched: improve tick time missed wakeup preempt protection
Date: Sun, 22 Nov 2009 13:08:02 +0100 [thread overview]
Message-ID: <1258891682.14325.31.camel@marge.simson.net> (raw)
sched: improve tick time missed wakeup preempt protection
f685ceac provides protection from tasks just missing wakeup preemption, and then
having to wait a full slice. However, it offers this protection to tasks which
have no business receiving the benefit, namely SCHED_BATCH and SCHED_IDLE. It
also treats all tasks equally, which obviously isn't true. Exclude tasks of
other than SCHED_NORMAL class, and scale minimum runtime before a tick time
preemption by the difference in task weights, after which, we can just use the
standard wakeup preempt vruntime delta test, sysctl_sched_wakeup_granularity.
Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
---
kernel/sched_fair.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
Index: linux-2.6/kernel/sched_fair.c
===================================================================
--- linux-2.6.orig/kernel/sched_fair.c
+++ linux-2.6/kernel/sched_fair.c
@@ -830,17 +830,23 @@ check_preempt_tick(struct cfs_rq *cfs_rq
* narrow margin doesn't have to wait for a full slice.
* This also mitigates buddy induced latencies under load.
*/
- if (!sched_feat(WAKEUP_PREEMPT))
+ if (!sched_feat(WAKEUP_PREEMPT) || cfs_rq->nr_running < 2)
return;
-
- if (delta_exec < sysctl_sched_min_granularity)
- return;
-
- if (cfs_rq->nr_running > 1) {
+ else {
struct sched_entity *se = __pick_next_entity(cfs_rq);
+ unsigned long min = sysctl_sched_min_granularity;
s64 delta = curr->vruntime - se->vruntime;
- if (delta > ideal_runtime)
+ if (task_of(se)->policy != SCHED_NORMAL)
+ return;
+ if (delta < 0)
+ return;
+ if (curr->load.weight != se->load.weight)
+ min = calc_delta_mine(min, curr->load.weight, &se->load);
+ if (delta_exec < min)
+ return;
+
+ if (delta > sysctl_sched_wakeup_granularity)
resched_task(rq_of(cfs_rq)->curr);
}
}
next reply other threads:[~2009-11-22 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 12:08 Mike Galbraith [this message]
2009-11-22 13:16 ` [patch] sched: improve tick time missed wakeup preempt protection Peter Zijlstra
2009-11-22 16:50 ` Mike Galbraith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258891682.14325.31.camel@marge.simson.net \
--to=efault@gmx.de \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox