mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-07 01:51:42 +00:00
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>
This commit is contained in:
parent
acb5a9ba3b
commit
2bd2d6f2dc
@ -321,11 +321,6 @@ static inline int entity_before(struct sched_entity *a,
|
|||||||
return (s64)(a->vruntime - b->vruntime) < 0;
|
return (s64)(a->vruntime - b->vruntime) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|
||||||
{
|
|
||||||
return se->vruntime - cfs_rq->min_vruntime;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void update_min_vruntime(struct cfs_rq *cfs_rq)
|
static void update_min_vruntime(struct cfs_rq *cfs_rq)
|
||||||
{
|
{
|
||||||
u64 vruntime = cfs_rq->min_vruntime;
|
u64 vruntime = cfs_rq->min_vruntime;
|
||||||
@ -359,7 +354,6 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|||||||
struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
|
struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
|
||||||
struct rb_node *parent = NULL;
|
struct rb_node *parent = NULL;
|
||||||
struct sched_entity *entry;
|
struct sched_entity *entry;
|
||||||
s64 key = entity_key(cfs_rq, se);
|
|
||||||
int leftmost = 1;
|
int leftmost = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -372,7 +366,7 @@ static void __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
|||||||
* We dont care about collisions. Nodes with
|
* We dont care about collisions. Nodes with
|
||||||
* the same key stay together.
|
* the same key stay together.
|
||||||
*/
|
*/
|
||||||
if (key < entity_key(cfs_rq, entry)) {
|
if (entity_before(se, entry)) {
|
||||||
link = &parent->rb_left;
|
link = &parent->rb_left;
|
||||||
} else {
|
} else {
|
||||||
link = &parent->rb_right;
|
link = &parent->rb_right;
|
||||||
|
Loading…
Reference in New Issue
Block a user