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

Yonghong Song

On Wed, Jul 31, 2019 at 1:34 AM <forrest0579@...> wrote:

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?
Could you post how to reproduce the issue so people can help?
If you do provide reproducible steps, could you submit an issue to
help tracking?


forrest chen

Join to automatically receive all group messages.