lkml.org 
[lkml]   [2008]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC/PATCH 17/17] sched: fair: optimize the elegebility test
Suggested by Dmitry Adamushko; trade a div for a mult.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/sched_fair.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
Index: linux-2.6-2/kernel/sched_fair.c
===================================================================
--- linux-2.6-2.orig/kernel/sched_fair.c
+++ linux-2.6-2/kernel/sched_fair.c
@@ -339,6 +339,12 @@ s64 avg_vruntime(struct cfs_root_rq *cfs
}

static inline
+int avg_vruntime_cmp(struct cfs_root_rq *cfs_r_rq, s64 vruntime)
+{
+ return (vruntime * cfs_r_rq->nr_queued) <= cfs_r_rq->avg_vruntime;
+}
+
+static inline
s64 entity_deadline_key(struct cfs_root_rq *cfs_r_rq, struct sched_entity *se)
{
return se->vruntime + se->vperiod - cfs_r_rq->min_vruntime;
@@ -430,11 +436,10 @@ static struct sched_entity *__pick_next_
*/
static struct sched_entity *__pick_next_entity(struct cfs_root_rq *cfs_r_rq)
{
- struct sched_entity *next_deadline;
- s64 avg = avg_vruntime(cfs_r_rq);
+ struct sched_entity *next_deadline = __pick_next_deadline(cfs_r_rq);
+ s64 vruntime = entity_timeline_key(cfs_r_rq, next_deadline);

- next_deadline = __pick_next_deadline(cfs_r_rq);
- if (entity_timeline_key(cfs_r_rq, next_deadline) <= avg)
+ if (avg_vruntime_cmp(cfs_r_rq, vruntime))
return next_deadline;

return __pick_next_timeline(cfs_r_rq);
--



\
 
 \ /
  Last update: 2008-03-09 18:15    [from the cache]
©2003-2011 Jasper Spaans