Skip to content

Commit d07f09a

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
sched/fair: Propagate enqueue flags into place_entity()
This allows place_entity() to consider ENQUEUE_WAKEUP and ENQUEUE_MIGRATED. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20230531124604.274010996@infradead.org
1 parent e4ec331 commit d07f09a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

kernel/sched/fair.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4909,7 +4909,7 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {}
49094909
#endif /* CONFIG_SMP */
49104910

49114911
static void
4912-
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
4912+
place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
49134913
{
49144914
u64 vslice = calc_delta_fair(se->slice, se);
49154915
u64 vruntime = avg_vruntime(cfs_rq);
@@ -4998,7 +4998,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
49984998
* on average, halfway through their slice, as such start tasks
49994999
* off with half a slice to ease into the competition.
50005000
*/
5001-
if (sched_feat(PLACE_DEADLINE_INITIAL) && initial)
5001+
if (sched_feat(PLACE_DEADLINE_INITIAL) && (flags & ENQUEUE_INITIAL))
50025002
vslice /= 2;
50035003

50045004
/*
@@ -5022,7 +5022,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
50225022
* update_curr().
50235023
*/
50245024
if (curr)
5025-
place_entity(cfs_rq, se, 0);
5025+
place_entity(cfs_rq, se, flags);
50265026

50275027
update_curr(cfs_rq);
50285028

@@ -5049,7 +5049,7 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
50495049
* we can place the entity.
50505050
*/
50515051
if (!curr)
5052-
place_entity(cfs_rq, se, 0);
5052+
place_entity(cfs_rq, se, flags);
50535053

50545054
account_entity_enqueue(cfs_rq, se);
50555055

@@ -12280,7 +12280,7 @@ static void task_fork_fair(struct task_struct *p)
1228012280
curr = cfs_rq->curr;
1228112281
if (curr)
1228212282
update_curr(cfs_rq);
12283-
place_entity(cfs_rq, se, 1);
12283+
place_entity(cfs_rq, se, ENQUEUE_INITIAL);
1228412284
rq_unlock(rq, &rf);
1228512285
}
1228612286

kernel/sched/sched.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ extern const u32 sched_prio_to_wmult[40];
21992199
#else
22002200
#define ENQUEUE_MIGRATED 0x00
22012201
#endif
2202+
#define ENQUEUE_INITIAL 0x80
22022203

22032204
#define RETRY_TASK ((void *)-1UL)
22042205

0 commit comments

Comments
 (0)