From: Ingo Molnar <mingo@elte.hu>
To: Mark Langsdorf <mark.langsdorf@amd.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Mike Galbraith <efault@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Prevent immediate process rescheduling
Date: Fri, 18 Sep 2009 21:54:55 +0200 [thread overview]
Message-ID: <20090918195455.GC11726@elte.hu> (raw)
In-Reply-To: <200909181449.12311.mark.langsdorf@amd.com>
(fixed the Cc: lines)
* Mark Langsdorf <mark.langsdorf@amd.com> wrote:
> Prevent the scheduler from immediately rescheduling a process
> that just yielded if there is another process available.
>
> Originally suggested by Mike Galbraith (efault@gmx.de).
>
> Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
> ---
> kernel/sched_fair.c | 16 +++++++++++++++-
> 1 files changed, 15 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
> index 652e8bd..4fad08f 100644
> --- a/kernel/sched_fair.c
> +++ b/kernel/sched_fair.c
> @@ -353,11 +353,25 @@ static void __dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
> static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq)
> {
> struct rb_node *left = cfs_rq->rb_leftmost;
> + struct sched_entity *se, *curr;
>
> if (!left)
> return NULL;
>
> - return rb_entry(left, struct sched_entity, run_node);
> + se = rb_entry(left, struct sched_entity, run_node);
> + curr = ¤t->se;
> +
> + /*
> + * Don't select the entity who just tried to schedule away
> + * if there's another entity available.
> + */
> + if (unlikely(se == curr && cfs_rq->nr_running > 1)) {
> + struct rb_node *next_node = rb_next(&curr->run_node);
> + if (next_node)
> + se = rb_entry(next_node, struct sched_entity, run_node);
> + }
> +
> + return se;
> }
I suspect some real workload is the motivation of this - what is that
workload?
Ingo
next prev parent reply other threads:[~2009-09-18 19:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-18 19:49 [PATCH] Prevent immediate process rescheduling Mark Langsdorf
2009-09-18 19:54 ` Ingo Molnar [this message]
2009-09-18 20:00 ` Langsdorf, Mark
2009-09-18 20:03 ` Peter Zijlstra
2009-09-19 2:16 ` Mike Galbraith
2009-09-19 9:03 ` Mike Galbraith
2009-09-19 8:31 ` Avi Kivity
2009-09-20 21:03 ` Langsdorf, Mark
2009-09-20 21:55 ` Avi Kivity
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=20090918195455.GC11726@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=efault@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.langsdorf@amd.com \
/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