BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Emil Tsalapatis" <emil@etsalapatis.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 3/4] bpf: Add sleepable local storage
Date: Tue, 24 Nov 2026 06:41:54 +0000	[thread overview]
Message-ID: <sashiko-outbox-230606@kernel.org> (raw)
In-Reply-To: <20261124060357.11700-4-emil@etsalapatis.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: missing __GFP_NOWARN in sleepable
  bpf_local_storage_alloc_mem()
--

commit 6a9b8094f2dfaf87e47ddf985c894923ff71ad36
Author: Emil Tsalapatis <emil@etsalapatis.com>

bpf: Add sleepable local storage

This commit uses bpf_map_kzalloc() with GFP_KERNEL | __GFP_RETRY_MAYFAIL
to allocate local storage when called from a sleepable BPF program in a
sleepable context.

> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> index 28eaee5c66ce8..74dfebf180970 100644
> --- a/kernel/bpf/bpf_local_storage.c
> +++ b/kernel/bpf/bpf_local_storage.c
> @@ -69,6 +69,10 @@ static bool selem_linked_to_map(const struct bpf_local_storage_elem *selem)
>  static void *bpf_local_storage_alloc_mem(struct bpf_local_storage_map *smap,
>  					size_t size, bool sleepable)
>  {
> +	if (sleepable)
> +		return bpf_map_kzalloc(&smap->map, size,
> +				       GFP_KERNEL | __GFP_RETRY_MAYFAIL);
> +
>  	return bpf_map_kmalloc_maylock(&smap->map, size, __GFP_ZERO);
>  }

[Severity: Low]
Should this bpf_map_kzalloc() call also pass __GFP_NOWARN?  Without it, an
allocation failure under memory pressure or higher-order fragmentation
triggers a warn_alloc() stack dump in dmesg, even though
bpf_local_storage_update() handles a NULL return gracefully.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124060357.11700-1-emil@etsalapatis.com?part=3

  parent reply	other threads:[~2026-11-24  6:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  6:03 [PATCH bpf-next v1 0/4] bpf: Use kmalloc for local storage if possible Emil Tsalapatis
2026-11-24  6:03 ` [PATCH bpf-next v1 1/4] bpf: Add call for selecting kmalloc or kmalloc_nolock at call time Emil Tsalapatis
2026-11-24  6:21   ` sashiko-bot
2026-11-24  6:40   ` Alexei Starovoitov
2026-11-24  6:40   ` bot+bpf-ci
2026-11-24  6:03 ` [PATCH bpf-next v1 2/4] bpf: Plumb local storage context Emil Tsalapatis
2026-11-24  6:17   ` sashiko-bot
2026-11-24  6:03 ` [PATCH bpf-next v1 3/4] bpf: Add sleepable local storage Emil Tsalapatis
2026-11-24  6:40   ` bot+bpf-ci
2026-11-24  6:41   ` sashiko-bot [this message]
2026-11-24  6:03 ` [PATCH bpf-next v1 4/4] selftests/bpf: Test kmalloc variant selection for task storage Emil Tsalapatis
2026-11-24  6:40   ` 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=sashiko-outbox-230606@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=sashiko-reviews@lists.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