Thread (5 messages) 5 messages, 4 authors, 2024-02-22

Re: [PATCH v3] modules: wait do_free_init correctly

From: Eric Chanudet <hidden>
Date: 2024-02-21 04:09:46
Also in: lkml

On Sun, Feb 18, 2024 at 01:21:53PM -0800, Andrew Morton wrote:
On Sat, 17 Feb 2024 16:18:10 +0800 Changbin Du [off-list ref] wrote:
quoted
The synchronization here is just to ensure the module init's been freed
before doing W+X checking. But the commit 1a7b7d922081 ("modules: Use
vmalloc special flag") moves do_free_init() into a global workqueue
instead of call_rcu(). So now rcu_barrier() can not ensure that do_free_init
has completed. We should wait it via flush_work().

Without this fix, we still could encounter false positive reports in
W+X checking, and the rcu synchronization is unnecessary which can
introduce significant delay.

Eric Chanudet reports that the rcu_barrier introduces ~0.1s delay on a
PREEMPT_RT kernel.
  [    0.291444] Freeing unused kernel memory: 5568K
  [    0.402442] Run /sbin/init as init process

With this fix, the above delay can be eliminated.
Thanks, I'll queue this as a delta, to be folded into the base patch
prior to upstreaming.

I added a Tested-by: Eric, if that's OK by him?
Absolutely, I should have put it in my initial reply.
Adding here as confirmation:
Tested-by: Eric Chanudet <redacted>

Thanks,

-- 
Eric Chanudet
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help