Re: [PATCH 2/2] jump_label: refine placement of static_keys

From: Eric Dumazet
Date: Wed Nov 10 2021 - 10:41:39 EST


On Wed, Nov 10, 2021 at 7:30 AM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>

>
> Sure, I can make sure to include all cases. I was hoping
> DEFINE_STATIC_KEY_TRUE()/DEFINE_STATIC_KEY_FALSE()
> would catch the majority of uses.
>
> We also can add a new DEFINE_STATIC_KEY() macro to ease these cases.

Although use of 'struct static_key' is marked deprecated.

I guess that we can leave legacy uses be converted by maintainers if they care.
(They do not have to, __static_key section is only a hint, not a requirement)

For instance these ones had no __read_mostly and nobody cared.

arch/x86/kernel/paravirt.c:124:struct static_key paravirt_steal_enabled;
arch/x86/kernel/paravirt.c:125:struct static_key paravirt_steal_rq_enabled;


>
>
>
> >
> > Would something like:
> >
> > typedef struct static_key __static_key static_key_t;
> >
> > work? I forever seem to forget the exact things you can make a typedef
> > do :/
>
> I tried, but a typedef was not working. A macro would work.