diff options
| author | Tejun Heo <tj@kernel.org> | 2026-07-13 22:18:43 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-07-13 22:18:43 -1000 |
| commit | d5b8f4cdd17dc42fd51048785fef1e2a7dd1117f (patch) | |
| tree | e8dcd5ca1c1fa84bf5702a1d06994b58376a2905 /init | |
| parent | c00158ef28b60bf3d793edc66eac74f7a20cc9d3 (diff) | |
| download | linux-stable-d5b8f4cdd17dc42fd51048785fef1e2a7dd1117f.tar.gz linux-stable-d5b8f4cdd17dc42fd51048785fef1e2a7dd1117f.zip | |
sched_ext: Track the cpu a task is runnable on
Add p->scx.runnable_cpu, the cpu @p is runnable on, or -1 when it is not.
It is stamped as @p joins the runnable_list (set_task_runnable()) and
cleared as it leaves (clr_task_runnable()), both under the rq lock.
task_cpu() can't answer "is @p on this rq" reliably: a remote wakeup changes
it under @p's pi_lock alone, without the source rq lock, so it can read as
the locked rq while @p is really elsewhere. runnable_cpu changes only under
the rq lock, so a caller holding an rq lock can compare against it to know
whether that is @p's current rq.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'init')
| -rw-r--r-- | init/init_task.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/init/init_task.c b/init/init_task.c index b67ef6040a65..5c7ad50ac685 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -145,6 +145,7 @@ struct task_struct init_task __aligned(L1_CACHE_BYTES) = { .dsq_list.node = LIST_HEAD_INIT(init_task.scx.dsq_list.node), .sticky_cpu = -1, .holding_cpu = -1, + .runnable_cpu = -1, .runnable_node = LIST_HEAD_INIT(init_task.scx.runnable_node), .runnable_at = INITIAL_JIFFIES, .ddsp_dsq_id = SCX_DSQ_INVALID, |
