Skip to content

Commit 0db0628

Browse files
author
Paul Gortmaker
committed
kernel: delete __cpuinit usage from all core kernel files
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. This removes all the uses of the __cpuinit macros from C files in the core kernel directories (kernel, init, lib, mm, and include) that don't really have a specific maintainer. [1] https://lkml.org/lkml/2013/5/20/589 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
1 parent 49fb4c6 commit 0db0628

27 files changed

Lines changed: 62 additions & 59 deletions

‎Documentation/cpu-hotplug.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ Q: If i have some kernel code that needs to be aware of CPU arrival and
267267
A: This is what you would need in your kernel code to receive notifications.
268268

269269
#include <linux/cpu.h>
270-
static int __cpuinit foobar_cpu_callback(struct notifier_block *nfb,
271-
unsigned long action, void *hcpu)
270+
static int foobar_cpu_callback(struct notifier_block *nfb,
271+
unsigned long action, void *hcpu)
272272
{
273273
unsigned int cpu = (unsigned long)hcpu;
274274

@@ -285,7 +285,7 @@ A: This is what you would need in your kernel code to receive notifications.
285285
return NOTIFY_OK;
286286
}
287287

288-
static struct notifier_block __cpuinitdata foobar_cpu_notifer =
288+
static struct notifier_block foobar_cpu_notifer =
289289
{
290290
.notifier_call = foobar_cpu_callback,
291291
};

‎include/linux/cpu.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ enum {
114114
/* Need to know about CPUs going up/down? */
115115
#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
116116
#define cpu_notifier(fn, pri) { \
117-
static struct notifier_block fn##_nb __cpuinitdata = \
117+
static struct notifier_block fn##_nb = \
118118
{ .notifier_call = fn, .priority = pri }; \
119119
register_cpu_notifier(&fn##_nb); \
120120
}

‎include/linux/perf_event.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ static inline void perf_restore_debug_store(void) { }
826826
*/
827827
#define perf_cpu_notifier(fn) \
828828
do { \
829-
static struct notifier_block fn##_nb __cpuinitdata = \
829+
static struct notifier_block fn##_nb = \
830830
{ .notifier_call = fn, .priority = CPU_PRI_PERF }; \
831831
unsigned long cpu = smp_processor_id(); \
832832
unsigned long flags; \

‎init/calibrate.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ __setup("lpj=", lpj_setup);
3131
#define DELAY_CALIBRATION_TICKS ((HZ < 100) ? 1 : (HZ/100))
3232
#define MAX_DIRECT_CALIBRATION_RETRIES 5
3333

34-
static unsigned long __cpuinit calibrate_delay_direct(void)
34+
static unsigned long calibrate_delay_direct(void)
3535
{
3636
unsigned long pre_start, start, post_start;
3737
unsigned long pre_end, end, post_end;
@@ -166,7 +166,10 @@ static unsigned long __cpuinit calibrate_delay_direct(void)
166166
return 0;
167167
}
168168
#else
169-
static unsigned long __cpuinit calibrate_delay_direct(void) {return 0;}
169+
static unsigned long calibrate_delay_direct(void)
170+
{
171+
return 0;
172+
}
170173
#endif
171174

172175
/*
@@ -180,7 +183,7 @@ static unsigned long __cpuinit calibrate_delay_direct(void) {return 0;}
180183
*/
181184
#define LPS_PREC 8
182185

183-
static unsigned long __cpuinit calibrate_delay_converge(void)
186+
static unsigned long calibrate_delay_converge(void)
184187
{
185188
/* First stage - slowly accelerate to find initial bounds */
186189
unsigned long lpj, lpj_base, ticks, loopadd, loopadd_base, chop_limit;
@@ -254,12 +257,12 @@ static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
254257
* Architectures should override this function if a faster calibration
255258
* method is available.
256259
*/
257-
unsigned long __attribute__((weak)) __cpuinit calibrate_delay_is_known(void)
260+
unsigned long __attribute__((weak)) calibrate_delay_is_known(void)
258261
{
259262
return 0;
260263
}
261264

262-
void __cpuinit calibrate_delay(void)
265+
void calibrate_delay(void)
263266
{
264267
unsigned long lpj;
265268
static bool printed;

‎kernel/cpu.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ EXPORT_SYMBOL(cpu_down);
366366
#endif /*CONFIG_HOTPLUG_CPU*/
367367

368368
/* Requires cpu_add_remove_lock to be held */
369-
static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
369+
static int _cpu_up(unsigned int cpu, int tasks_frozen)
370370
{
371371
int ret, nr_calls = 0;
372372
void *hcpu = (void *)(long)cpu;
@@ -419,7 +419,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
419419
return ret;
420420
}
421421

422-
int __cpuinit cpu_up(unsigned int cpu)
422+
int cpu_up(unsigned int cpu)
423423
{
424424
int err = 0;
425425

@@ -618,7 +618,7 @@ core_initcall(cpu_hotplug_pm_sync_init);
618618
* It must be called by the arch code on the new cpu, before the new cpu
619619
* enables interrupts and before the "boot" cpu returns from __cpu_up().
620620
*/
621-
void __cpuinit notify_cpu_starting(unsigned int cpu)
621+
void notify_cpu_starting(unsigned int cpu)
622622
{
623623
unsigned long val = CPU_STARTING;
624624

‎kernel/events/core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7630,7 +7630,7 @@ static void __init perf_event_init_all_cpus(void)
76307630
}
76317631
}
76327632

7633-
static void __cpuinit perf_event_init_cpu(int cpu)
7633+
static void perf_event_init_cpu(int cpu)
76347634
{
76357635
struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu);
76367636

@@ -7719,7 +7719,7 @@ static struct notifier_block perf_reboot_notifier = {
77197719
.priority = INT_MIN,
77207720
};
77217721

7722-
static int __cpuinit
7722+
static int
77237723
perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
77247724
{
77257725
unsigned int cpu = (long)hcpu;

‎kernel/fork.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ static inline void init_idle_pids(struct pid_link *links)
15461546
}
15471547
}
15481548

1549-
struct task_struct * __cpuinit fork_idle(int cpu)
1549+
struct task_struct *fork_idle(int cpu)
15501550
{
15511551
struct task_struct *task;
15521552
task = copy_process(CLONE_VM, 0, 0, NULL, &init_struct_pid, 0);

‎kernel/hrtimer.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ SYSCALL_DEFINE2(nanosleep, struct timespec __user *, rqtp,
16591659
/*
16601660
* Functions related to boot-time initialization:
16611661
*/
1662-
static void __cpuinit init_hrtimers_cpu(int cpu)
1662+
static void init_hrtimers_cpu(int cpu)
16631663
{
16641664
struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
16651665
int i;
@@ -1740,7 +1740,7 @@ static void migrate_hrtimers(int scpu)
17401740

17411741
#endif /* CONFIG_HOTPLUG_CPU */
17421742

1743-
static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
1743+
static int hrtimer_cpu_notify(struct notifier_block *self,
17441744
unsigned long action, void *hcpu)
17451745
{
17461746
int scpu = (long)hcpu;
@@ -1773,7 +1773,7 @@ static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
17731773
return NOTIFY_OK;
17741774
}
17751775

1776-
static struct notifier_block __cpuinitdata hrtimers_nb = {
1776+
static struct notifier_block hrtimers_nb = {
17771777
.notifier_call = hrtimer_cpu_notify,
17781778
};
17791779

‎kernel/printk.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ void resume_console(void)
19211921
* called when a new CPU comes online (or fails to come up), and ensures
19221922
* that any such output gets printed.
19231923
*/
1924-
static int __cpuinit console_cpu_notify(struct notifier_block *self,
1924+
static int console_cpu_notify(struct notifier_block *self,
19251925
unsigned long action, void *hcpu)
19261926
{
19271927
switch (action) {

‎kernel/profile.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)
331331
put_cpu();
332332
}
333333

334-
static int __cpuinit profile_cpu_callback(struct notifier_block *info,
334+
static int profile_cpu_callback(struct notifier_block *info,
335335
unsigned long action, void *__cpu)
336336
{
337337
int node, cpu = (unsigned long)__cpu;

0 commit comments

Comments
 (0)