Re: [PATCH 1/1] sched.h: always_inline alloc_tag_{save|restore} to fix modpost warnings
From: Andrew Morton
Date: Thu Jul 04 2024 - 01:17:07 EST
On Wed, 3 Jul 2024 21:25:30 -0700 Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> > > I don't think it's really a problem. __init function is executing, it
> > > calls a function from .text (say alloc_tag_save() that was not
> > > inlined) which in turn calls get_current(), which returns a pointer
> > > somewhere inside __initdata. That should be fine since this can only
> > > happen during init stage. If this call happens after init,
> > > get_current() can't return a pointer from __initdata. If it does then
> > > we have a much bigger problem.
> >
> > So I think you're saying "yes, the warning is legitimate and this might
> > be a problem, but it isn't in this case, so the checking code is OK so
> > let's just work around it"?
>
> Yes, that's my understanding. If get_current() always returns a valid
> pointer for the given execution stage (during init/after init) then it
> should be safe to call it even from a function residing in the .text
> section during init.
Make sense, thanks for confirming. I'll await the v2 series, if
you think it remains appropriate?