diff options
author | Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de> | 2011-07-20 08:46:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-07-21 12:01:55 -0400 |
commit | 2bd2d6f2dc952fc44fc52887de36e51896da96b9 (patch) | |
tree | 0b08e0ae13cad776cb216a4b85b1eb8d6eda6611 /kernel/sched_fair.c | |
parent | acb5a9ba3bd7cd8b3264f67a3789a9587d3b935b (diff) |
sched: Replace use of entity_key()
"entity_key()" is only used in "__enqueue_entity()" and
its only function is to subtract a tasks vruntime by
its groups minvruntime.
Before this patch a rbtree enqueue-decision is done by
comparing two tasks in the style:
"if (entity_key(cfs_rq, se) < entity_key(cfs_rq, entry))"
which would be
"if (se->vruntime-cfs_rq->min_vruntime < entry->vruntime-cfs_rq->min_vruntime)"
or (if reducing cfs_rq->min_vruntime out)
"if (se->vruntime < entry->vruntime)"
which is
"if (entity_before(se, entry))"
So we do not need "entity_key()".
If "entity_before()" is inline we will also save one subtraction (only one,
because "entity_key(cfs_rq, se)" was cached in "key")
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-ns12mnd2h5w8rb9agd8hnsfk@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 0588c0b933a8..a2ecbaa28b4c 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -321,11 +321,6 @@ static inline int entity_before(struct sched_entity *a, | |||
321 | return (s64)(a->vruntime - b->vruntime) < 0; | 321 | return (s64)(a->vruntime - b->vruntime) < 0; |
322 | } | 322 | } |
323 | 323 | ||
324 | static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se) | ||
325 | { | ||
326 | return se->vruntime - cfs_rq->min_vruntime; | ||
327 | } | ||
328 | |||
329 | static void update_min_vruntime(struct cfs_rq *cfs_rq) | 324 | static void update_min_vruntime(struct cfs_rq *cfs_rq) |
330 | { | 325 | { |
331 | u64 vruntime = cfs_rq->min_vruntime; | 326 | u64 vruntime = cfs_rq->min_vruntime; |
@@ -359,7 +354,6 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
359 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; | 354 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; |
360 | struct rb_node *parent = NULL; | 355 | struct rb_node *parent = NULL; |
361 | struct sched_entity *entry; | 356 | struct sched_entity *entry; |
362 | s64 key = entity_key(cfs_rq, se); | ||
363 | int leftmost = 1; | 357 | int leftmost = 1; |
364 | 358 | ||
365 | /* | 359 | /* |
@@ -372,7 +366,7 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
372 | * We dont care about collisions. Nodes with | 366 | * We dont care about collisions. Nodes with |
373 | * the same key stay together. | 367 | * the same key stay together. |
374 | */ | 368 | */ |
375 | if (key < entity_key(cfs_rq, entry)) { | 369 | if (entity_before(se, entry)) { |
376 | link = &parent->rb_left; | 370 | link = &parent->rb_left; |
377 | } else { | 371 | } else { |
378 | link = &parent->rb_right; | 372 | link = &parent->rb_right; |