From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Benjamin Tissoires <bentiss@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
Shuah Khan <shuah@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 2/3] bpf: do not walk twice the hash map on free
Date: Tue, 30 Apr 2024 14:52:35 +0200 [thread overview]
Message-ID: <CAP01T76NyoYc4Y6k_ArbjfUn1tVjxSa0SpqVzEtM0h9jdRvgDg@mail.gmail.com> (raw)
In-Reply-To: <20240430-bpf-next-v3-2-27afe7f3b17c@kernel.org>
On Tue, 30 Apr 2024 at 12:44, Benjamin Tissoires <bentiss@kernel.org> wrote:
>
> If someone stores both a timer and a workqueue in a hash map, on free, we
> would walk it twice.
> Add a check in htab_free_malloced_timers_or_wq and free the timers
> and workqueues if they are present.
>
> Fixes: 246331e3f1ea ("bpf: allow struct bpf_wq to be embedded in arraymaps and hashmaps")
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
>
> ---
I had forgotten how the extra_elems logic is working, turns out
everything is in the preallocated elems array and per-cpu extra_elems
stores the *pointer* to them for recycling without hitting the pcpu
allocator, so should be fine (just in case this confuses anyone else).
>
> changes in v3:
> - fix unloading of bpf_wq, again
>
> changes in v2:
> - fix wq being not freed (and static call not used)
> ---
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
next prev parent reply other threads:[~2024-04-30 12:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 10:43 [PATCH bpf-next v3 0/3] bpf_wq followup series Benjamin Tissoires
2024-04-30 10:43 ` [PATCH bpf-next v3 1/3] bpf: do not walk twice the map on free Benjamin Tissoires
2024-04-30 12:37 ` Kumar Kartikeya Dwivedi
2024-04-30 10:43 ` [PATCH bpf-next v3 2/3] bpf: do not walk twice the hash " Benjamin Tissoires
2024-04-30 12:52 ` Kumar Kartikeya Dwivedi [this message]
2024-04-30 10:43 ` [PATCH bpf-next v3 3/3] selftests/bpf: drop an unused local variable Benjamin Tissoires
2024-04-30 12:37 ` Kumar Kartikeya Dwivedi
2024-04-30 14:40 ` [PATCH bpf-next v3 0/3] bpf_wq followup series 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=CAP01T76NyoYc4Y6k_ArbjfUn1tVjxSa0SpqVzEtM0h9jdRvgDg@mail.gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bentiss@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=sdf@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).