From: Sven Eckelmann <sven@narfation.org>
To: marek.lindner@mailbox.org, sw@simonwunderlich.de,
antonio@mandelbit.com, "Ömer Mete Kaya" <omermetekaya0@gmail.com>
Cc: davem@davemloft.net, b.a.t.m.a.n@lists.open-mesh.org,
linux-kernel@vger.kernel.org,
syzbot+61b202fdc410840f0198@syzkaller.appspotmail.com
Subject: Re: [PATCH net] batman-adv: reduce softirq drain in tt_purge loops
Date: Sat, 31 Oct 2026 09:39:49 +0100 [thread overview]
Message-ID: <2282819.irdbgypaU6@sven-desktop> (raw)
In-Reply-To: <48b23995-4f67-4f3b-8988-78546cc23ecd@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2569 bytes --]
On Saturday, 31 October 2026 01:02:27 CET Ömer Mete Kaya wrote:
> I think keeping the batching approach is the better option since
> cond_resched() alone does not reduce the number of inline softirq
> drains. But if you prefer the simpler per-bucket spin_lock_bh()
> with only cond_resched(), I will go that route for v2.
My understanding seems to be completely different. There is are two major
changes - one is the actual optimization and then a second one which only
applied in some situations:
I need an explanation in the commit message which tells us what the
problematic situation is and why the approach of an outer local_bh_disable()
is the correct one.
But since you have also an cond_resched() in the middle, I need also an
explanation why this is required/good idea. And why it is not a problem to not
have cond_resched in some contexts. I am not talking about the technical
problem (commit_lock - which still needs to be mentioned) but why it doesn't
cause problems that there is no cond_resched there.
Not to forget about an explanation why the time for the worker doesn't stay
stable when it has a lot of softirq work which is done anyway on the BH re-
enable points. The number of these BH re-enable points is lower but the total
amount of work it needs to do stays the same - (without this explanation) you
could therefore argue that just more softirq work is done per BH re-enable
point and therefore the total amount of time spend by the worker (with the
softirq time) stays the same. As result, we would still see the splat (see
syzkaller report).
> > This looks like a workaround for a problem which isn't described very well.
> > Are there any precedents in the Linux kernel?
> >
> > I know of things like ctnetlink_dump_table() with the large local_bh_disable()
> > and inner spinlocks. But I know of nothing with the cond_resched. But since I
> > don't know why it was added in the first place, I would a better explanation
> > of the problem and the reasoning why it was tried to be fixed like you did.
>
> ctnetlink_dump_table() in net/netfilter/nf_conntrack_netlink.c uses
> an outer local_bh_disable() with inner spin_lock()/
> spin_unlock() calls on per-bucket locks.
As said in my message: no cond_resched in ctnetlink_dump_table()
> nf_ct_iterate_cleanup() also uses cond_resched() while walking the
> conntrack hash, although it re-enables BHs at a different granularity.
No outer local_bh_disable() and only a mutex around the main loop.
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-10-31 8:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 23:59 [PATCH net] batman-adv: reduce softirq drain in tt_purge loops Ömer Mete Kaya
2026-10-30 8:25 ` Sven Eckelmann
2026-10-31 0:02 ` Ömer Mete Kaya
2026-10-31 8:39 ` Sven Eckelmann [this message]
2026-10-31 14:19 ` Sven Eckelmann
2026-10-30 22:00 ` kernel test robot
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=2282819.irdbgypaU6@sven-desktop \
--to=sven@narfation.org \
--cc=antonio@mandelbit.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.lindner@mailbox.org \
--cc=omermetekaya0@gmail.com \
--cc=sw@simonwunderlich.de \
--cc=syzbot+61b202fdc410840f0198@syzkaller.appspotmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.