Re: [PATCH sched_ext/for-7.4-fixes 0/2] sched_ext: Fix two races between fork and scx_post_fork()

From: Tejun Heo

Date: Fri Dec 04 2026 - 11:41:15 EST


Hello, Hang.

On Fri, Dec 04, 2026 at 01:27:42AM +0000, Hang Zhengyang wrote:
> Before scx_post_fork() runs, a new task can be reached by
> sched_setscheduler() (patch 1, since v6.12) and by a cgroup migration to
> another sub-scheduler (patch 2). Either can make ops.enable() run twice
> or trip the task state check.

Thanks for the fixes. Both changes look correct to me. A few style and
documentation points:

- The new comments mostly describe what the code does and not why. Can you
update them to explain why? The one in switching_to_scx() is also
difficult to follow.

- 1/2: Can switched_from_scx() read the task state once and test that?

- 2/2: scx_rehome_task() tests for the same condition as 1/2 but in a
different style. Can you make it test the same way?

Thanks.

--
tejun