Re: [PATCH] include/linux/module.h: mark init/cleanup_module aliases as __cold

From: Miguel Ojeda
Date: Wed Feb 06 2019 - 12:28:57 EST


On Wed, Feb 6, 2019 at 5:31 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> On Mon, Feb 4, 2019 at 4:08 PM Jessica Yu <jeyu@xxxxxxxxxx> wrote:
> >
> > IMHO I think annotating with __init is more straightforward, instead
> > of cherry-picking attributes (we wouldn't know at first glance why the
> > aliases are specifically annotated with __cold without looking at git
> > history). Plus the actual module init function and alias declarations
> > would be consistent. Just looking at the __init attributes:
> >
> > #define __init __section(.init.text) __cold __latent_entropy __noinitretpoline

By the way, note that we also need to annotate the exit ones. To do
something similar, for __exit we have:

#define __exit __section(.exit.text) __exitused __cold notrace

__exitused expands to nothing when MODULE is defined.

notrace is either hotpatch(0,0) or no_instrument_function; and they
shouldn't matter in the alias since we are not generating code (and
anyway they disable the extra code, instead of enabling).

So I will also use __exit there instead of only __cold too.

Cheers,
Miguel