the size of BPF_MAP_TYPE_PERCPU_ARRAY doesn't match the number of CPU


Forrest Chen
 

Hi all,

I define a BPF_MAP_TYPE_PERCPU_ARRAY and use it to count packets in the xdp program. When I read the map from userspace program, I find that the entry number doesn't match local CPU numbers. I have 2 CPUs in my VM, but the count result appear in index 0 and 2, my expectation is index 0 and 1. 
So why the counting result always appear in index 0 and 2 (or CPU 0 and 2), even when my VM only have 2 cores. Does it because I run the program in VM?

Thanks,
forrest chen

Join iovisor-dev@lists.iovisor.org to automatically receive all group messages.