Re: [PATCH] sched/deadline: Use task_on_rq_migrating() helper
From: Peter Zijlstra
Date: Mon Jun 08 2026 - 04:02:59 EST
On Mon, Jun 08, 2026 at 02:53:07PM +0800, luoliang@xxxxxxxxxx wrote:
> From: Liang Luo <luoliang@xxxxxxxxxx>
>
> Replace the open-coded "p->on_rq == TASK_ON_RQ_MIGRATING" comparisons
> in enqueue_task_dl() and dequeue_task_dl() with the existing
> task_on_rq_migrating() helper, consistent with the rest of the
> scheduler code.
>
> The helper uses READ_ONCE() when loading ->on_rq, which was added by
> commit c546951d9c93 ("sched/core: Use READ_ONCE()/WRITE_ONCE() in
> move_queued_task()/task_rq_lock()") for LKMM compliance. As documented
> in that commit, move_queued_task() synchronizes with task_rq_lock():
>
> move_queued_task() task_rq_lock()
> [S] ->on_rq = MIGRATING [L] rq = task_rq()
> WMB (__set_task_cpu()) ACQUIRE (rq->lock)
> [S] ->cpu = new_cpu [L] ->on_rq
>
> The READ_ONCE() on the ->on_rq load ensures proper pairing with the
> WRITE_ONCE() on the writer side. The open-coded checks in deadline.c
> lack this annotation.
>
> No functional change.
This is completely irrelevant here. p->on_rq is set with rq->lock held,
and tasks are {en,de}queued with rq->lock held. There is no concurrency.