Re: [PATCH v2 2/2] livepatch: Replace tasklist_lock with RCU

2025-02-25 Thread Yafang Shao
On Wed, Feb 26, 2025 at 2:33 AM Josh Poimboeuf wrote: > > On Sun, Feb 23, 2025 at 02:20:46PM +0800, Yafang Shao wrote: > > +++ b/kernel/livepatch/patch.c > > @@ -95,7 +95,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, > > > > patch_state = current->patch_state; > > >

Re: [PATCH v2 2/2] livepatch: Replace tasklist_lock with RCU

2025-02-25 Thread Josh Poimboeuf
On Sun, Feb 23, 2025 at 02:20:46PM +0800, Yafang Shao wrote: > +++ b/kernel/livepatch/patch.c > @@ -95,7 +95,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, > > patch_state = current->patch_state; > > - WARN_ON_ONCE(patch_state == KLP_TRANSITION_IDLE); >

[PATCH v2 2/2] livepatch: Replace tasklist_lock with RCU

2025-02-22 Thread Yafang Shao
The tasklist_lock in the KLP transition may cause high latency under certain workloads. To address this, we can replace it with RCU. When a new task is forked, its kernel stack is always initialized to empty[0]. As a result, we can set these new tasks to the KLP_TRANSITION_IDLE state immediately a