| From: D. Hugh Redelmeier <hugh(a)mimosa.com>
| On my machine (AMD Athlon x2), it unconditionally prints 2304 structs,
| each taking 27 lines. Of those, only 23 appear to have been used in
| the day that the machine had been up.
| I wonder why the kernel allocates so many irq_desc entries. According
| to "nm -f sysv vmlinux", irq_desc is 294912 bytes -- more than the
| whole RAM on the first UNIX machine I used.
include/asm-x86_64/irq.h defines NR_IRQS:
#define NR_IRQS (NR_VECTORS + (32 *NR_CPUS))
NR_VECTORS is 256.
So NR_CPUS must be defined to be 64 on my machine. I wish I had that
many CPUs.
NR_CPUS seems to be defined here:
include/linux/threads.h:17:#define NR_CPUS CONFIG_NR_CPUS
CONFIG_NR_CPUS is defined in .config:
CONFIG_NR_CPUS=64
There is a comment in thread.h that suggests that NR_CPUS is the
number of bits in a bitmask on the platform (32 or 64).
Perhaps the array of irqs is addressed in a way that you know which
ones are useless if you know how many CPUs there actually are (at
runtime). Or perhaps if you know how many there were at most since
processors might come and go.