Re: [PATCH v3 2/3] livepatch: Include exiting tasks in the transition

From: Ravindran, Binoy

Date: Wed Nov 25 2026 - 19:58:56 EST



Thanks, this is right. A dying task reports its quiescent state in
rcu_note_context_switch(), early in __schedule(), and then still runs
traceable code, such as update_rq_clock() and pick_next_task(), until
switch_to(). RCU does not promise to wait for code after that point, and
with expedited grace periods the quiescent state is reported right
there, so synchronize_rcu() can return too early.
klp_synchronize_transition(), which v2 used, does not have this
problem: schedule_on_each_cpu() completes only after the work item has
run on every CPU, which on the dying task's CPU happens only after
switch_to().

v4 goes back to klp_synchronize_transition() for both waits and keeps
klp_try_switch_exiting_tasks() from v3. I will send it after rerunning
the tests.

Yafang, this reverses your second suggestion; I hope the reason above
makes sense. It also brings back the v2 transition times.

Binoy