On !SMP systems, we end up with the following array definition:
static struct cpuhp_step cpuhp_ap_states[] = {
[CPUHP_ONLINE] = {
.name = "online",
.startup.single = NULL,
.teardown.single = NULL,
},
};
where CPUHP_ONLINE = 187. That means up to 99.5% of this array is unused
but still allocated in the kernel's .data section i.e. 3760 bytes.
The same issue exists with cpuhp_bp_states being 1720 bytes.
The goal of this patch is mainly about illustrating the issue and
reducing .data usage. I have no clear idea when this stuff is really
needed besides standard CPU hotplug. Not knowing exactly what I'm doing
here, I made it conditional on CONFIG_SMP for now. There might be a case
for moving that code to a separate file (cpuhp.c maybe?) and omitting it
from the kernel when unneeded.
Comments?
+#ifdef CONFIG_CPUHP
+#define ___P(proto, def_retcode) extern proto;
+#else
+#define ___P(proto, def_retcode) static inline proto { return def_retcode } +#endif
+
+___P(
int __cpuhp_setup_state(enum cpuhp_state state, const char *name, bool invoke,
int (*startup)(unsigned int cpu),
- int (*teardown)(unsigned int cpu), bool multi_instance);
-
+ int (*teardown)(unsigned int cpu), bool multi_instance), 0; )
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 294 |
Nodes: | 16 (2 / 14) |
Uptime: | 247:28:35 |
Calls: | 6,626 |
Calls today: | 2 |
Files: | 12,175 |
Messages: | 5,320,897 |