diff options
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 86e5e8c5d101..895fef74d99a 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -124,11 +124,18 @@ set_leftmost(struct cfs_rq *cfs_rq, struct rb_node *leftmost) | |||
124 | cfs_rq->rb_leftmost = leftmost; | 124 | cfs_rq->rb_leftmost = leftmost; |
125 | if (leftmost) { | 125 | if (leftmost) { |
126 | se = rb_entry(leftmost, struct sched_entity, run_node); | 126 | se = rb_entry(leftmost, struct sched_entity, run_node); |
127 | cfs_rq->min_vruntime = max(se->vruntime, | 127 | if ((se->vruntime > cfs_rq->min_vruntime) || |
128 | cfs_rq->min_vruntime); | 128 | (cfs_rq->min_vruntime > (1ULL << 61) && |
129 | se->vruntime < (1ULL << 50))) | ||
130 | cfs_rq->min_vruntime = se->vruntime; | ||
129 | } | 131 | } |
130 | } | 132 | } |
131 | 133 | ||
134 | s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se) | ||
135 | { | ||
136 | return se->fair_key - cfs_rq->min_vruntime; | ||
137 | } | ||
138 | |||
132 | /* | 139 | /* |
133 | * Enqueue an entity into the rb-tree: | 140 | * Enqueue an entity into the rb-tree: |
134 | */ | 141 | */ |
@@ -138,7 +145,7 @@ __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
138 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; | 145 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; |
139 | struct rb_node *parent = NULL; | 146 | struct rb_node *parent = NULL; |
140 | struct sched_entity *entry; | 147 | struct sched_entity *entry; |
141 | s64 key = se->fair_key; | 148 | s64 key = entity_key(cfs_rq, se); |
142 | int leftmost = 1; | 149 | int leftmost = 1; |
143 | 150 | ||
144 | /* | 151 | /* |
@@ -151,7 +158,7 @@ __enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
151 | * We dont care about collisions. Nodes with | 158 | * We dont care about collisions. Nodes with |
152 | * the same key stay together. | 159 | * the same key stay together. |
153 | */ | 160 | */ |
154 | if (key - entry->fair_key < 0) { | 161 | if (key < entity_key(cfs_rq, entry)) { |
155 | link = &parent->rb_left; | 162 | link = &parent->rb_left; |
156 | } else { | 163 | } else { |
157 | link = &parent->rb_right; | 164 | link = &parent->rb_right; |