[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <200909181449.12311.mark.langsdorf@amd.com>
Date: Fri, 18 Sep 2009 14:49:12 -0500
From: Mark Langsdorf <mark.langsdorf@....com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH] Prevent immediate process rescheduling
Prevent the scheduler from immediately rescheduling a process
that just yielded if there is another process available.
Originally suggested by Mike Galbraith (efault@....de).
Signed-off-by: Mark Langsdorf <mark.langsdorf@....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;
}
static struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
--
1.6.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists