Re: [PATCH v3] modules: wait do_free_init correctly

From: Eric Chanudet
Date: Tue Feb 20 2024 - 23:09:55 EST


On Sun, Feb 18, 2024 at 01:21:53PM -0800, Andrew Morton wrote:
> On Sat, 17 Feb 2024 16:18:10 +0800 Changbin Du <changbin.du@xxxxxxxxxx> wrote:
> > 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 <echanude@xxxxxxxxxx>

Thanks,

--
Eric Chanudet