From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Jiayuan Chen" <jiayuan.chen@linux.dev>, <bpf@vger.kernel.org>
Cc: "Emil Tsalapatis" <emil@etsalapatis.com>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"Shuah Khan" <shuah@kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH bpf-next v8 1/3] bpf: arena: allocate the fault-in page outside the lock
Date: Fri, 18 Sep 2026 17:59:35 +0000 [thread overview]
Message-ID: <DLIMZ5I345V6.2VWICG8UTQD4D@gmail.com> (raw)
In-Reply-To: <20260918084123.39477-2-jiayuan.chen@linux.dev>
On Fri, Sep 18, 2026 at 04:40 PM Jiayuan Chen <jiayuan.chen@linux.dev> wrote:
> @@ -489,59 +490,108 @@ static vm_fault_t arena_vm_fault(struct vm_fault *vmf)
> kbase = bpf_arena_get_kern_vm_start(arena);
> kaddr = kbase + (u32)(vmf->address);
>
> - if (raw_res_spin_lock_irqsave(&arena->spinlock, flags))
> + page = vmalloc_to_page((void *)kaddr);
> + if (!page && !(arena->map.map_flags & BPF_F_SEGV_ON_FAULT)) {
> + /*
> + * Preallocate outside the lock so the allocation can sleep and
> + * reclaim, which the non-blocking allocator under
> + * arena->spinlock cannot. __GFP_RETRY_MAYFAIL: reclaim, but
> + * never OOM-kill in the map's memcg, which need not be the
> + * faulting task's. On failure, fallthrough: the locked
> + * recheck below picks up a page a concurrent allocator may
> + * have installed meanwhile, and otherwise the non-blocking
> + * fallback fails and we return VM_FAULT_SIGBUS. Not
> + * VM_FAULT_OOM: nothing ran the OOM killer, an
d the fault path
> + * would just retry it forever.
> + */
I asked for one line comment. This block and the one in !new_page
branch below repeat the commit log. Trim both to a sentence or two.
pw-bot: cr
next prev parent reply other threads:[~2026-09-18 17:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 8:40 [PATCH bpf-next v8 0/3] bpf: arena: handle memory.max on fault-in with reclaim Jiayuan Chen
2026-09-18 8:40 ` [PATCH bpf-next v8 1/3] bpf: arena: allocate the fault-in page outside the lock Jiayuan Chen
2026-09-18 9:51 ` bot+bpf-ci
2026-09-18 17:59 ` Alexei Starovoitov [this message]
2026-09-18 8:40 ` [PATCH bpf-next v8 2/3] selftests/bpf: Add read_cgroup_file() to cgroup_helpers Jiayuan Chen
2026-09-18 8:40 ` [PATCH bpf-next v8 3/3] selftests/bpf: Add a test for arena fault-in under memory.max Jiayuan Chen
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=DLIMZ5I345V6.2VWICG8UTQD4D@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jiayuan.chen@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®