lkml.org 
[lkml]   [2010]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC PATCH 05/11] sched buddy enable buddy logic starting at 2 running threads
Extracted from a "sched-misc-bits.patch" patch from
Peter Zijlstra <a.p.zijlstra@chello.nl>.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/sched_fair.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6-lttng.git/kernel/sched_fair.c
===================================================================
--- linux-2.6-lttng.git.orig/kernel/sched_fair.c
+++ linux-2.6-lttng.git/kernel/sched_fair.c
@@ -1647,7 +1647,11 @@ static void check_preempt_wakeup(struct
struct task_struct *curr = rq->curr;
struct sched_entity *se = &curr->se, *pse = &p->se;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);
- int scale = cfs_rq->nr_running >= sched_nr_latency;
+ /*
+ * The buddy logic doesn't work well when there's not actually enough
+ * tasks for there to be buddies.
+ */
+ int buddies = (cfs_rq->nr_running >= 2);

if (unlikely(rt_prio(p->prio)))
goto preempt;
@@ -1658,7 +1662,7 @@ static void check_preempt_wakeup(struct
if (unlikely(se == pse))
return;

- if (sched_feat(NEXT_BUDDY) && scale && !(wake_flags & WF_FORK))
+ if (sched_feat(NEXT_BUDDY) && buddies && !(wake_flags & WF_FORK))
set_next_buddy(pse);

/*
@@ -1704,7 +1708,7 @@ preempt:
if (unlikely(!se->on_rq || curr == rq->idle))
return;

- if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se))
+ if (sched_feat(LAST_BUDDY) && buddies && entity_is_task(se))
set_last_buddy(se);
}



\
 
 \ /
  Last update: 2010-08-26 20:17    [W:0.119 / U:17.344 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site