From: Eric Dumazet <eric.duma...@gmail.com> Date: Fri, 19 Aug 2016 21:07:52 -0700
> Here is an example of a system I had in the past. > > 8 cpus (num_possible_cpus() returns 8) > > Cpus were numbered : 0, 1, 2, 3, 8, 9, 10, 11 : (nr_cpu_ids = 12) > > I am pretty sure they are still alive. > > Since you want an array indexed by cpu numbers, you need to size it by > nr_cpu_ids, otherwise array[11] will crash / access garbage. > > This is why you find many nr_cpu_ids in the linux tree, not > num_possible_cpus() to size arrays. My bad, I misunderstood what nr_cpu_ids means. You are absolutely right.