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


Forrest Chen
 

On Thu, Aug 1, 2019 at 07:16 PM, Yonghong Song wrote:
I guess you mean value size. here.
When you got the values from kernel, the value size is rounded to 8. See
https://github.com/torvalds/linux/blob/master/kernel/bpf/arraymap.c#L81

So if you use 64bit value size, you will get correct value.
If you use 32bit value size, you should iterate through with int64_t
size, but only read the first 4 bytes for each iteration.
Thank you, Yonghong Song

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