From: sashiko-bot@kernel.org
To: "Jose Fernandez (Anthropic)" <jose.fernandez@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf] bpf: Avoid soft lockup in __htab_map_lookup_and_delete_batch()
Date: Fri, 10 Jul 2026 00:05:01 +0000 [thread overview]
Message-ID: <20260710000502.5D7B01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-b4-htab-batch-resched-v1-1-ad7a6b3b4513@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Multi-line comments do not follow BPF subsystem guidelines.
--
--- Patch [1]: [PATCH bpf] bpf: Avoid soft lockup in __htab_map_lookup_and_delete_batch() ---
commit a1114e030dd1f8d190db49effffca17e5da09d3f
Author: Jose Fernandez (Anthropic) <jose.fernandez@linux.dev>
bpf: Avoid soft lockup in __htab_map_lookup_and_delete_batch()
This commit limits the number of consecutive empty buckets visited in
__htab_map_lookup_and_delete_batch() before yielding. It drops locks and
calls cond_resched() to prevent soft lockup watchdogs from firing on
large sparse maps.
> diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> --- a/kernel/bpf/hashtab.c
> +++ b/kernel/bpf/hashtab.c
> @@ -1769,6 +1769,11 @@ static int htab_lru_percpu_map_lookup_and_delete_elem(struct bpf_map *map,
> flags);
> }
>
> +/* Max consecutive empty buckets to walk in one RCU +
> + * instrumentation-disabled section before rescheduling.
> + */
> +#define HTAB_BATCH_EMPTY_RESCHED 64
[Severity: Low]
This isn't a bug, but does this multi-line comment follow the preferred BPF
subsystem comment style? The guidelines specify that the opening /* should
be on its own line, rather than having text on the same line.
[ ... ]
> @@ -1969,11 +1975,19 @@ __htab_map_lookup_and_delete_batch(struct bpf_map *map,
>
> next_batch:
> - /* If we are not copying data, we can go to next bucket and avoid
> - * unlocking the rcu.
> + /* If we are not copying data, we can go to next bucket and avoid
> + * unlocking the rcu. Bound the walk though: after
> + * HTAB_BATCH_EMPTY_RESCHED consecutive empty buckets, fully exit
> + * the critical section (no locks are held here) and reschedule.
> */
[Severity: Low]
Similarly, could this multi-line comment be updated to place the opening /*
on its own line to match the modern BPF comment style?
> if (!bucket_cnt && (batch + 1 < htab->n_buckets)) {
> batch++;
> - goto again_nocopy;
> + if (++empty_cnt < HTAB_BATCH_EMPTY_RESCHED)
> + goto again_nocopy;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-b4-htab-batch-resched-v1-1-ad7a6b3b4513@linux.dev?part=1
prev parent reply other threads:[~2026-07-10 0:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 23:57 [PATCH bpf] bpf: Avoid soft lockup in __htab_map_lookup_and_delete_batch() Jose Fernandez (Anthropic)
2026-07-10 0:05 ` sashiko-bot [this message]
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=20260710000502.5D7B01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jose.fernandez@linux.dev \
--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