Skip to content

Commit 22f0a27

Browse files
author
Paul Gortmaker
committed
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 5e427ec ("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 78d86c2 ("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>
1 parent 9e895ac commit 22f0a27

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎include/linux/init.h‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@
9393

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

96-
/* Used for HOTPLUG_CPU */
97-
#define __cpuinit __section(.cpuinit.text) __cold notrace
98-
#define __cpuinitdata __section(.cpuinit.data)
99-
#define __cpuinitconst __constsection(.cpuinit.rodata)
100-
#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
101-
#define __cpuexitdata __section(.cpuexit.data)
102-
#define __cpuexitconst __constsection(.cpuexit.rodata)
96+
/* temporary, until all users are removed */
97+
#define __cpuinit
98+
#define __cpuinitdata
99+
#define __cpuinitconst
100+
#define __cpuexit
101+
#define __cpuexitdata
102+
#define __cpuexitconst
103103

104104
/* Used for MEMORY_HOTPLUG */
105105
#define __meminit __section(.meminit.text) __cold notrace
@@ -118,9 +118,8 @@
118118
#define __INITRODATA .section ".init.rodata","a",%progbits
119119
#define __FINITDATA .previous
120120

121-
#define __CPUINIT .section ".cpuinit.text", "ax"
122-
#define __CPUINITDATA .section ".cpuinit.data", "aw"
123-
#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
121+
/* temporary, until all users are removed */
122+
#define __CPUINIT
124123

125124
#define __MEMINIT .section ".meminit.text", "ax"
126125
#define __MEMINITDATA .section ".meminit.data", "aw"

0 commit comments

Comments
 (0)