On Fri, 1 Mar 2019 11:35:17 -0800, Andrii Nakryiko wrote: > > > Do you think that would work? Using array is a bit limiting, because > > > it doesn't allow to do partial reads/updates, while BPF_MAP_TYPE_HEAP > > > would be single big value that allows partial reading/updating. > > > > If I understand it correctly, the main difference this would have is > > to be able to use spin_locks in a more fine-grained fashion, right? > > spin_lock is just a nice bonus, if there is any manipulation that > isn't <= 8 byte long that needs to be done atomically. > > The reason for this new type of map is actually ability to update > global variables from outside BPF program in granular fashion. E.g., > turning on some extra debug output temporarily, tuning parameters, > changing PID to trace, etc, without stopping and reloading BPF > program. With array, it's all-or-nothing: to update anything you have > to overwrite entire .data section. As I mentioned, if we can get BTF > type information for entirety of .data, it would allow to manipulate > those variables by name even with generic tools like bpftool. Sounds like you'd almost want to mmap the value ;)