Re: [PATCH next] sched,freezer: prevent tasks from escaping being frozen
From: Michal Koutný
Date: Thu Jul 03 2025 - 13:02:11 EST
Hello Ridong.
On Thu, Jul 03, 2025 at 01:34:27PM +0000, Chen Ridong <chenridong@xxxxxxxxxxxxxxx> wrote:
> 2. The cgroup freezer state changes to FROZEN (Can be triggered by reading
> freezer.state).
/o\
> 3. freezing() is called and returns false.
I can see how this can happen because freezer_lock != freezer_mutex.
> As a result, the task may escape being frozen when it should be.
>
> To fix this, move the setting of the FROZEN flag to occur just before
> schedule(). This ensures the flag is only set when we're certain the
> task must be switched out.
Is it sufficient? (If the task is spuriously woken up, the next
iteration in that refrigerator loop would be subject to same race, no?)
Thanks,
Michal
Attachment:
signature.asc
Description: PGP signature