mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Omar Ramadan <omar@blockcast.net>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Taehee Yoo <ap420073@gmail.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2] amt: make the per-tunnel group and source limits configurable
Date: Thu,  5 Nov 2026 02:33:40 +0000	[thread overview]
Message-ID: <20261105023340.19774-1-omar@blockcast.net> (raw)
In-Reply-To: <361bbccf-6ce7-4b1f-bd55-4d8270423320@redhat.com>

On 10/21/26 15:30, Paolo Abeni wrote:
>> +	amt->max_sources = nla_get_u32_default(data[IFLA_AMT_MAX_SOURCES], 0) ?:
>> +			   AMT_MAX_SOURCE;
>>   	amt->hash_buckets = AMT_HSIZE;
>
> Sashiko noted that with this setting is very easy to livelock the host.
> At very least you should scale `hash_buckets` accordingly, possibly move some
> processing out of the RX path.

Thanks Paolo, and sorry for the slow reply. Agreed: as posted, v2 lets
one Membership Update hold tunnel->lock in softirq for far too long.

I reproduced it at the v2 ceilings in a UML guest. One 64 KiB Update of
about 7,500 empty records, all naming a group that holds 4,096
sources, held tunnel->lock for 1.7 to 2.3 seconds.

For v3 I plan to:

- make the A-B case of amt_lookup_act_srcs() linear, as its own patch.
  Today it compares every source in the group with every source in the
  record;
- bound the source-state work of one Update. Each group record is
  charged for its passes over the group, and the report stops once it
  exceeds twice the cost of refreshing the tunnel's whole state;
- size hash_buckets from max_sources (at most 8 sources per bucket,
  256 to 512), and lower the group ceiling from 1024 to 512, which
  keeps one tunnel's worst case at about 4.75 MiB.

With those, the same Update stops after 26 to 45 ms in the same guest,
while a full refresh at the ceilings (512 groups x 8 sources) stays at
about 5 to 10 ms. UML is slow and noisy, so these numbers are only
useful compared with each other.

That keeps the processing in the RX path. Once the work is bounded, a
per-tunnel work item would add a queue and limits of its own without
changing the worst case much, so I left it out. If you would still
prefer the processing deferred, I'll do that in v3 instead.

Sashiko also flagged an existing race between the source timer and
tunnel teardown. v5 of my net series "amt: relay tunnel lifetime,
validation and request-path hardening" fixes it, and I am posting that
next. v3 of this patch depends on it, so I'll post v3 once that series
is in net-next.

pw-bot: cr

      reply	other threads:[~2026-11-05  2:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 23:18 Omar Ramadan
2026-10-19 23:20 ` netdev-bot+sashiko
2026-10-21 13:30 ` Paolo Abeni
2026-11-05  2:33   ` Omar Ramadan [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=20261105023340.19774-1-omar@blockcast.net \
    --to=omar@blockcast.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®