Skip to content

Commit d434210

Browse files
committed
sched_ext: Move consume_local_task() upward
So that the local case comes first and two CONFIG_SMP blocks can be merged. No functional changes intended. Signed-off-by: Tejun Heo <[email protected]> Acked-by: David Vernet <[email protected]>
1 parent 6557133 commit d434210

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

kernel/sched/ext.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,20 @@ static bool yield_to_task_scx(struct rq *rq, struct task_struct *to)
21722172
return false;
21732173
}
21742174

2175+
static void consume_local_task(struct task_struct *p,
2176+
struct scx_dispatch_q *dsq, struct rq *rq)
2177+
{
2178+
lockdep_assert_held(&dsq->lock); /* released on return */
2179+
2180+
/* @dsq is locked and @p is on this rq */
2181+
WARN_ON_ONCE(p->scx.holding_cpu >= 0);
2182+
task_unlink_from_dsq(p, dsq);
2183+
list_add_tail(&p->scx.dsq_list.node, &rq->scx.local_dsq.list);
2184+
dsq_mod_nr(&rq->scx.local_dsq, 1);
2185+
p->scx.dsq = &rq->scx.local_dsq;
2186+
raw_spin_unlock(&dsq->lock);
2187+
}
2188+
21752189
#ifdef CONFIG_SMP
21762190
/**
21772191
* move_task_to_local_dsq - Move a task from a different rq to a local DSQ
@@ -2207,23 +2221,6 @@ static void move_task_to_local_dsq(struct task_struct *p, u64 enq_flags,
22072221
dst_rq->scx.extra_enq_flags = 0;
22082222
}
22092223

2210-
#endif /* CONFIG_SMP */
2211-
2212-
static void consume_local_task(struct task_struct *p,
2213-
struct scx_dispatch_q *dsq, struct rq *rq)
2214-
{
2215-
lockdep_assert_held(&dsq->lock); /* released on return */
2216-
2217-
/* @dsq is locked and @p is on this rq */
2218-
WARN_ON_ONCE(p->scx.holding_cpu >= 0);
2219-
task_unlink_from_dsq(p, dsq);
2220-
list_add_tail(&p->scx.dsq_list.node, &rq->scx.local_dsq.list);
2221-
dsq_mod_nr(&rq->scx.local_dsq, 1);
2222-
p->scx.dsq = &rq->scx.local_dsq;
2223-
raw_spin_unlock(&dsq->lock);
2224-
}
2225-
2226-
#ifdef CONFIG_SMP
22272224
/*
22282225
* Similar to kernel/sched/core.c::is_cpu_allowed(). However, there are two
22292226
* differences:

0 commit comments

Comments
 (0)