init.h: remove __cpuinit sections from the kernel

The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications.  For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.

After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out.  Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.

As an interim step, we can dummy out the macros to be no-ops, and
this will allow us to avoid a giant tree-wide patch, and instead
we can feed in smaller chunks mainly via the arch/ trees.  This
is in keeping with commit 78d86c213f
("init.h: Remove __dev* sections from the kernel")

We don't strictly need to dummy out the macros to do this, but if
we don't then some harmless section mismatch warnings may temporarily
result.  For example, notify_cpu_starting() and cpu_up() are arch
independent (kernel/cpu.c) and are flagged as __cpuinit.  And hence
the calling functions in the arch specific code are also expected
to be __cpuinit -- if not, then we get the section mismatch warning.

Two of the three __CPUINIT variants are not used whatsoever, and
so they are simply removed directly at this point in time.

[1] https://lkml.org/lkml/2013/5/20/589

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
This commit is contained in:
Paul Gortmaker 2013-06-17 18:34:14 -04:00
parent 9e895ace5d
commit 22f0a27367

View file

@ -93,13 +93,13 @@
#define __exit __section(.exit.text) __exitused __cold notrace
/* Used for HOTPLUG_CPU */
#define __cpuinit __section(.cpuinit.text) __cold notrace
#define __cpuinitdata __section(.cpuinit.data)
#define __cpuinitconst __constsection(.cpuinit.rodata)
#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
#define __cpuexitdata __section(.cpuexit.data)
#define __cpuexitconst __constsection(.cpuexit.rodata)
/* temporary, until all users are removed */
#define __cpuinit
#define __cpuinitdata
#define __cpuinitconst
#define __cpuexit
#define __cpuexitdata
#define __cpuexitconst
/* Used for MEMORY_HOTPLUG */
#define __meminit __section(.meminit.text) __cold notrace
@ -118,9 +118,8 @@
#define __INITRODATA .section ".init.rodata","a",%progbits
#define __FINITDATA .previous
#define __CPUINIT .section ".cpuinit.text", "ax"
#define __CPUINITDATA .section ".cpuinit.data", "aw"
#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
/* temporary, until all users are removed */
#define __CPUINIT
#define __MEMINIT .section ".meminit.text", "ax"
#define __MEMINITDATA .section ".meminit.data", "aw"