Re: [PATCH v2 0/2] sched, livepatch: Fix transition stall for CPU-bound tasks
From: Peter Zijlstra
Date: Wed Nov 25 2026 - 04:51:17 EST
On Wed, Nov 25, 2026 at 04:18:58AM +0000, Dylan Hatch wrote:
> Commit 676e8cf70cb0 ("sched,livepatch: Untangle cond_resched() and
> live-patching") moved klp_sched_try_switch() from _cond_resched() into
> __schedule() and gated it on READ_ONCE(curr->__state) & TASK_FREEZABLE.
> This causes livepatch transitions to stall when CPU-bound kthreads,
> PF_USER_WORKER threads (such as vhost-<pid>), or user tasks in long
> kernel loops spin with cond_resched():
>
> 1. Even when __schedule() is entered via preemption or an unfreezable
> sleep (such as PF_NOFREEZE kthreads or PF_USER_WORKER threads
> sleeping in TASK_INTERRUPTIBLE), curr->__state does not have
> TASK_FREEZABLE set, so klp_sched_try_switch() skips the task.
> 2. A sole runnable task spinning in the kernel never gets
> TIF_NEED_RESCHED set during sched_tick(). In klp_send_signals(),
> wake_up_state(task, TASK_INTERRUPTIBLE) is a no-op for a
> TASK_RUNNING task, and set_notify_signal() sets TIF_NOTIFY_SIGNAL
> without TIF_NEED_RESCHED, so the resulting reschedule IPI returns to
> kernel mode without entering __schedule().
How does the freezer handle this? I mean, systems doing this must also
still suspend, right?