This NR_CPUS-dimensioned array is likely unused on most installations.
Therefore it is especially wasteful for it to consume more space than
really needed. Use the smallest possible type.
Further the array having all fields set to -1 is actually useless. Nothing
relies on it, and core_parking_remove() doesn't restore the sentinel for
vacated slots. Drop the initializers, moving the array to .bss.
Finally take the opportunity and update an adjacent variable's type, where
a fixed-width type was pretty clearly inappropriate to use.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I assume there is a reason this is acting (mostly) as a LIFO. Else a
simple cpumask_t would suffice.
An alternative would be to use the new BRK allocator, at least for NR_CPUS
above a certain threshold.
--- a/xen/common/core_parking.c
+++ b/xen/common/core_parking.c
@@ -27,8 +27,16 @@
#define CORE_PARKING_DECREMENT 2
static DEFINE_SPINLOCK(accounting_lock);
-static uint32_t cur_idle_nums;
-static unsigned int core_parking_cpunum[NR_CPUS] = {[0 ... NR_CPUS-1] = -1};
+static unsigned int cur_idle_nums;
+static
+#if CONFIG_NR_CPUS <= (1U << BITS_PER_BYTE)
+ unsigned char
+#elif CONFIG_NR_CPUS <= (1U << (BITS_PER_BYTE * __SIZEOF_SHORT__))
+ unsigned short
+#else
+ unsigned int
+#endif
+ core_parking_cpunum[CONFIG_NR_CPUS];
struct cp_policy {
char name[30];