From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: <chenyuan_fl@163.com>, <bpf@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
"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>,
"Yuan Chen" <chenyuan@kylinos.cn>
Subject: Re: [PATCH bpf-next v6 2/3] bpf, arena: fix range_tree_set inconsistency on kmalloc_nolock failure
Date: Wed, 23 Sep 2026 02:02:05 +0000 [thread overview]
Message-ID: <DLMBQRAXRIZ2.2SHAA85YGTKSX@gmail.com> (raw)
In-Reply-To: <20260922072102.3570856-1-chenyuan_fl@163.com>
On Tue, Sep 22, 2026 at 03:21 PM chenyuan_fl@163.com <chenyuan_fl@163.com> wrote:
> + /*
> + * The pre-clear probe only decides whether a fresh node is needed;
> + * adjacency on either side is invariant across the clear, so it can
> + * run before the tree is modified and -ENOMEM leaves it untouched.
> + * The merge below re-fetches its handles after the clear instead of
> + * relying on the overlapping nodes being updated in place.
> + */
> + left = range_it_iter_first(rt, start - 1, start - 1);
> + right = range_it_iter_first(rt, last + 1, last + 1);
[...]
> /* Do we have a left-adjacent range ? */
> left = range_it_iter_first(rt, start - 1, start - 1);
In v4 I asked why the 2nd lookup is needed. It's not.
range_tree_clear() frees only the nodes that are entirely inside
[start, last]. A node that covers start - 1 or last + 1 is trimmed
in place. The split case cannot happen here because of the
'already set' check above. So left and right found before the clear
are the same nodes that the 2nd lookup returns.
Do the lookup once and drop the comment.
next prev parent reply other threads:[~2026-09-23 2:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 13:40 [PATCH bpf-next v4 0/3] bpf, arena: fix range_tree consistency on allocation failure chenyuan_fl
2026-08-24 13:40 ` [PATCH bpf-next v4 1/3] bpf, arena: fix range_tree_clear inconsistency on kmalloc_nolock failure chenyuan_fl
2026-08-24 14:35 ` bot+bpf-ci
2026-08-24 13:40 ` [PATCH bpf-next v4 2/3] bpf, arena: fix range_tree_set " chenyuan_fl
2026-08-24 14:35 ` bot+bpf-ci
2026-08-27 2:56 ` Alexei Starovoitov
2026-09-01 7:01 ` chenyuan
2026-09-02 9:37 ` [PATCH bpf-next v5 0/3] bpf, arena: fix range_tree consistency on allocation failure chenyuan_fl
2026-09-02 9:37 ` [PATCH bpf-next v5 1/3] bpf, arena: fix range_tree_clear inconsistency on kmalloc_nolock failure chenyuan_fl
2026-09-02 9:37 ` [PATCH bpf-next v5 2/3] bpf, arena: fix range_tree_set " chenyuan_fl
2026-09-02 9:37 ` [PATCH bpf-next v5 3/3] bpf, arena: handle range_tree_set failures in alloc/free paths chenyuan_fl
2026-09-08 15:53 ` Emil Tsalapatis
2026-09-22 6:58 ` [PATCH bpf-next v6 0/3] bpf, arena: fix range_tree consistency on allocation failure chenyuan_fl
2026-09-22 7:20 ` [PATCH bpf-next v6 1/3] bpf, arena: fix range_tree_clear inconsistency on kmalloc_nolock failure chenyuan_fl
2026-09-22 7:21 ` [PATCH bpf-next v6 2/3] bpf, arena: fix range_tree_set " chenyuan_fl
2026-09-22 8:24 ` bot+bpf-ci
2026-09-23 2:02 ` Alexei Starovoitov [this message]
2026-09-22 7:21 ` [PATCH bpf-next v6 3/3] bpf, arena: check range_tree_set return in arena_free_pages and arena_free_worker chenyuan_fl
2026-09-23 2:02 ` Alexei Starovoitov
2026-09-23 8:58 ` [PATCH bpf-next v7 0/2] bpf, arena: fix range_tree consistency on allocation failure chenyuan_fl
2026-09-23 8:58 ` [PATCH bpf-next v7 1/2] bpf, arena: fix range_tree_clear inconsistency on kmalloc_nolock failure chenyuan_fl
2026-09-23 9:34 ` bot+bpf-ci
2026-09-23 8:58 ` [PATCH bpf-next v7 2/2] bpf, arena: fix range_tree_set " chenyuan_fl
2026-09-23 9:34 ` bot+bpf-ci
2026-08-24 13:40 ` [PATCH bpf-next v4 3/3] bpf, arena: check range_tree_set return in arena_free_pages and arena_free_worker chenyuan_fl
2026-08-24 14:35 ` bot+bpf-ci
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=DLMBQRAXRIZ2.2SHAA85YGTKSX@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyuan@kylinos.cn \
--cc=chenyuan_fl@163.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--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®