bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hou Tao <houtao@huaweicloud.com>
To: YiFei Zhu <zhuyifei@google.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Stanislav Fomichev <sdf@google.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH bpf 1/2] bpf/memalloc: Non-atomically allocate freelist during prefill
Date: Wed, 26 Jul 2023 19:38:08 +0800	[thread overview]
Message-ID: <0d242e21-3f53-87ca-7aa8-bb55b5223552@huaweicloud.com> (raw)
In-Reply-To: <CAA-VZPmhm3SoD+tX-xPSj6wuOvFg=uZoar0b=sgAyLRz=5n+2A@mail.gmail.com>

Hi,

On 7/21/2023 10:31 AM, YiFei Zhu wrote:
> On Thu, Jul 20, 2023 at 6:45 PM Hou Tao <houtao@huaweicloud.com> wrote:
>> On 7/21/2023 4:44 AM, YiFei Zhu wrote:
>>> Sometimes during prefill all precpu chunks are full and atomic
>>> __alloc_percpu_gfp would not allocate new chunks. This will cause
>>> -ENOMEM immediately upon next unit_alloc.
>>>
>>> Prefill phase does not actually run in atomic context, so we can
>>> use this fact to allocate non-atomically with GFP_KERNEL instead
>>> of GFP_NOWAIT. This avoids the immediate -ENOMEM. Unfortunately
>>> unit_alloc runs in atomic context, even from map item allocation in
>>> syscalls, due to rcu_read_lock, so we can't do non-atomic
>>> workarounds in unit_alloc.
>>>
>>> Fixes: 4ab67149f3c6 ("bpf: Add percpu allocation support to bpf_mem_alloc.")
>>> Signed-off-by: YiFei Zhu <zhuyifei@google.com>
>> Make sense to me, so
>>
>> Acked-by: Hou Tao <houtao1@huawei.com>
>>
>> But I don't know whether or not it is suitable for bpf tree.
> I don't mind either way :) If changing to bpf-next requires a resend I
> can do that too.

Please resend and rebase the patch again bpf-next tree.


  reply	other threads:[~2023-07-26 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 20:44 [PATCH bpf 0/2] bpf/memalloc: Allow non-atomic alloc_bulk YiFei Zhu
2023-07-20 20:44 ` [PATCH bpf 1/2] bpf/memalloc: Non-atomically allocate freelist during prefill YiFei Zhu
2023-07-21  1:44   ` Hou Tao
2023-07-21  2:31     ` YiFei Zhu
2023-07-26 11:38       ` Hou Tao [this message]
2023-07-26 18:44         ` YiFei Zhu
2023-07-27  1:21           ` Hou Tao
2023-07-20 20:44 ` [PATCH bpf 2/2] bpf/memalloc: Schedule highprio wq for non-atomic alloc when atomic fails YiFei Zhu
2023-07-21  2:24   ` Hou Tao
2023-07-21  3:02     ` YiFei Zhu
2023-07-26 11:37       ` Hou Tao

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=0d242e21-3f53-87ca-7aa8-bb55b5223552@huaweicloud.com \
    --to=houtao@huaweicloud.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=zhuyifei@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).