On Wed, Nov 15, 2023 at 7:32 AM Heiko Carstens <hca@xxxxxxxxxxxxx> wrote: > > On Sun, Aug 27, 2023 at 08:27:34AM -0700, Yonghong Song wrote: > > This is needed for later percpu mem allocation when the > > allocation is done by bpf program. For such cases, a global > > bpf_global_percpu_ma is added where a flexible allocation > > size is needed. > > > > Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx> > > --- > > include/linux/bpf.h | 4 ++-- > > kernel/bpf/core.c | 8 +++++--- > > kernel/bpf/memalloc.c | 14 ++++++-------- > > 3 files changed, 13 insertions(+), 13 deletions(-) > > Both Marc and Mikhail reported out-of-memory conditions on s390 machines, > and bisected it down to this upstream commit 41a5db8d8161 ("bpf: Add > support for non-fix-size percpu mem allocation"). > This seems to eat up a lot of memory only based on the number of possible > CPUs. > > If we have a machine with 8GB, 6 present CPUs and 512 possible CPUs (yes, > this is a realistic scenario) the memory consumption directly after boot > is: > > $ cat /sys/devices/system/cpu/present > 0-5 > $ cat /sys/devices/system/cpu/possible > 0-511 > > Before this commit: > > $ cat /proc/meminfo > MemTotal: 8141924 kB > MemFree: 7639872 kB > > With this commit > > $ cat /proc/meminfo > MemTotal: 8141924 kB > MemFree: 4852248 kB > > So, this appears to be a significant regression. > I'm quoting the rest of the original patch below for reference only. Yes. Sorry about this. The issue slipped through. It's fixed in bpf tree by commit: https://patchwork.kernel.org/project/netdevbpf/patch/20231111013928.948838-1-yonghong.song@xxxxxxxxx/ The fix will be sent to Linus soon.