All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Hou Tao <houtao@huaweicloud.com>, Heiko Carstens <hca@linux.ibm.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com, Martin KaFai Lau <martin.lau@kernel.org>,
	Marc Hartmayer <mhartmay@linux.ibm.com>,
	Mikhail Zaslonko <zaslonko@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 01/13] bpf: Add support for non-fix-size percpu mem allocation
Date: Thu, 16 Nov 2023 00:52:56 -0500	[thread overview]
Message-ID: <5ff45ce6-f1bb-462c-9b1e-aadfb881808a@linux.dev> (raw)
In-Reply-To: <379ff74e-cad2-919c-4130-adbe80d50a26@huaweicloud.com>


On 11/15/23 8:15 PM, Hou Tao wrote:
> Hi,
>
> On 11/15/2023 11:31 PM, Heiko Carstens 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@linux.dev>
>>> ---
>>>   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
> Will the present CPUs be hot-added dynamically and eventually increase
> to 512 CPUs ? Or will the present CPUs rarely be hot-added ? After all
> possible CPUs are online, will these CPUs be hot-plugged dynamically ?
> Because I am considering add CPU hotplug support for bpf mem allocator,
> so we can allocate memory according to the present CPUs instead of
> possible CPUs. But if the present CPUs will be increased to all possible
> CPUs quickly, there will be not too much benefit to support hotplug in
> bpf mem allocator.

Thanks, Hou. In my development machine and also checking
some internal production machines, no suprisingly, the 'present' number
cpus is equal to the 'possible' number of cpus. I suspect in most cases,
'present' and 'possible' are the same. But it would be good that
other people can share their 'present != possible' configuration
and explain why.


  reply	other threads:[~2023-11-16  5:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 15:27 [PATCH bpf-next v3 00/13] bpf: Add support for local percpu kptr Yonghong Song
2023-08-27 15:27 ` [PATCH bpf-next v3 01/13] bpf: Add support for non-fix-size percpu mem allocation Yonghong Song
2023-09-13 14:10   ` Hou Tao
2023-11-15 15:31   ` Heiko Carstens
2023-11-15 15:54     ` Alexei Starovoitov
2023-11-16  1:15     ` Hou Tao
2023-11-16  5:52       ` Yonghong Song [this message]
2023-11-16 13:54       ` Heiko Carstens
2023-08-27 15:27 ` [PATCH bpf-next v3 02/13] bpf: Add BPF_KPTR_PERCPU as a field type Yonghong Song
2023-08-27 15:27 ` [PATCH bpf-next v3 03/13] bpf: Add alloc/xchg/direct_access support for local percpu kptr Yonghong Song
2023-09-06  0:40   ` Alexei Starovoitov
2023-08-27 15:27 ` [PATCH bpf-next v3 04/13] bpf: Add bpf_this_cpu_ptr/bpf_per_cpu_ptr support for allocated percpu obj Yonghong Song
2023-08-27 15:27 ` [PATCH bpf-next v3 05/13] selftests/bpf: Update error message in negative linked_list test Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 06/13] libbpf: Add __percpu_kptr macro definition Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 07/13] selftests/bpf: Add bpf_percpu_obj_{new,drop}() macro in bpf_experimental.h Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 08/13] selftests/bpf: Add tests for array map with local percpu kptr Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 09/13] bpf: Mark OBJ_RELEASE argument as MEM_RCU when possible Yonghong Song
2023-09-06  0:37   ` Alexei Starovoitov
2023-08-27 15:28 ` [PATCH bpf-next v3 10/13] selftests/bpf: Remove unnecessary direct read of local percpu kptr Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 11/13] selftests/bpf: Add tests for cgrp_local_storage with " Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 12/13] selftests/bpf: Add some negative tests Yonghong Song
2023-08-27 15:28 ` [PATCH bpf-next v3 13/13] bpf: Mark BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE deprecated Yonghong Song
2023-09-06  0:50 ` [PATCH bpf-next v3 00/13] bpf: Add support for local percpu kptr patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ff45ce6-f1bb-462c-9b1e-aadfb881808a@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hca@linux.ibm.com \
    --cc=houtao@huaweicloud.com \
    --cc=kernel-team@fb.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=mhartmay@linux.ibm.com \
    --cc=zaslonko@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.