From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Hou Tao <houtao@huaweicloud.com>
Cc: bpf@vger.kernel.org, "Martin KaFai Lau" <martin.lau@linux.dev>,
"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>, "Hao Luo" <haoluo@google.com>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Jiri Olsa" <jolsa@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Thomas Weißschuh" <linux@weissschuh.net>,
houtao1@huawei.com, xukuohai@huawei.com
Subject: Re: [PATCH bpf-next 07/10] bpf: Switch to bpf mem allocator for LPM trie
Date: Mon, 18 Nov 2024 14:30:02 +0100 [thread overview]
Message-ID: <20241118133002.Ev7Lo3kN@linutronix.de> (raw)
In-Reply-To: <20241118010808.2243555-8-houtao@huaweicloud.com>
On 2024-11-18 09:08:05 [+0800], Hou Tao wrote:
> diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
> index d447a6dab83b..d8995acecedf 100644
> --- a/kernel/bpf/lpm_trie.c
> +++ b/kernel/bpf/lpm_trie.c
> @@ -319,6 +326,25 @@ static int trie_check_noreplace_update(const struct lpm_trie *trie, u64 flags)
> return 0;
> }
>
> +static void lpm_trie_node_free(struct lpm_trie *trie,
> + struct lpm_trie_node *node, bool defer)
> +{
> + struct bpf_mem_alloc *ma;
> +
> + if (!node)
> + return;
> +
> + ma = (node->flags & LPM_TREE_NODE_FLAG_ALLOC_LEAF) ? trie->leaf_ma :
> + trie->im_ma;
> +
> + migrate_disable();
> + if (defer)
> + bpf_mem_cache_free_rcu(ma, node);
> + else
> + bpf_mem_cache_free(ma, node);
> + migrate_enable();
I guess a preempt_disable() here instead wouldn't hurt much. The inner
pieces of the allocator (unit_free()) does local_irq_save() for the
entire function so we don't win much with migrate_disable().
> +}
> +
Sebastian
next prev parent reply other threads:[~2024-11-18 13:30 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 1:07 [PATCH bpf-next 00/10] Fixes for LPM trie Hou Tao
2024-11-18 1:07 ` [PATCH bpf-next 01/10] bpf: Remove unnecessary check when updating " Hou Tao
2024-11-21 10:22 ` Toke Høiland-Jørgensen
2024-11-18 1:08 ` [PATCH bpf-next 02/10] bpf: Remove unnecessary kfree(im_node) in lpm_trie_update_elem Hou Tao
2024-11-21 10:25 ` Toke Høiland-Jørgensen
2024-11-18 1:08 ` [PATCH bpf-next 03/10] bpf: Handle BPF_EXIST and BPF_NOEXIST for LPM trie Hou Tao
2024-11-18 13:39 ` Thomas Weißschuh
2024-11-19 1:08 ` Hou Tao
2024-11-21 10:32 ` Toke Høiland-Jørgensen
2024-11-18 1:08 ` [PATCH bpf-next 04/10] bpf: Handle in-place update for full LPM trie correctly Hou Tao
2024-11-18 13:13 ` Sebastian Andrzej Siewior
2024-11-19 1:05 ` Hou Tao
2024-11-21 10:53 ` Toke Høiland-Jørgensen
2024-11-22 2:06 ` Hou Tao
2024-11-18 1:08 ` [PATCH bpf-next 05/10] bpf: Fix exact match conditions in trie_get_next_key() Hou Tao
2024-11-21 11:01 ` Toke Høiland-Jørgensen
2024-11-18 1:08 ` [PATCH bpf-next 06/10] bpf: Add bpf_mem_cache_is_mergeable() helper Hou Tao
2024-11-18 13:29 ` Thomas Weißschuh
2024-11-19 1:06 ` Hou Tao
2024-11-18 1:08 ` [PATCH bpf-next 07/10] bpf: Switch to bpf mem allocator for LPM trie Hou Tao
2024-11-18 13:30 ` Sebastian Andrzej Siewior [this message]
2024-11-18 16:56 ` Yonghong Song
2024-11-20 1:16 ` Alexei Starovoitov
2024-11-21 1:20 ` Hou Tao
2024-11-23 3:29 ` Alexei Starovoitov
2024-11-21 11:39 ` Toke Høiland-Jørgensen
2024-11-21 11:52 ` Thomas Weißschuh
2024-11-21 12:50 ` Toke Høiland-Jørgensen
2024-11-22 3:36 ` Hou Tao
2024-11-18 1:08 ` [PATCH bpf-next 08/10] bpf: Use raw_spinlock_t " Hou Tao
2024-11-18 1:08 ` [PATCH bpf-next 09/10] selftests/bpf: Move test_lpm_map.c to map_tests Hou Tao
2024-11-18 1:08 ` [PATCH bpf-next 10/10] selftests/bpf: Add more test cases for LPM trie Hou Tao
2024-11-18 17:46 ` Daniel Borkmann
2024-11-19 1:10 ` Hou Tao
[not found] ` <46268aa9ef13a24388af833b17f6cef8bdd3a7be8402fec7640e65a2f1118468@mail.kernel.org>
2024-11-18 6:20 ` [PATCH bpf-next 00/10] Fixes " Hou Tao
2024-11-18 17:43 ` Daniel Xu
2024-11-19 1:09 ` Hou Tao
2024-11-18 15:39 ` Sebastian Andrzej Siewior
2024-11-19 1:35 ` Hou Tao
2024-11-19 14:15 ` Sebastian Andrzej Siewior
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=20241118133002.Ev7Lo3kN@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=houtao1@huawei.com \
--cc=houtao@huaweicloud.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux@weissschuh.net \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=tglx@linutronix.de \
--cc=xukuohai@huawei.com \
--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