From: Kuniyuki Iwashima <kuniyu@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH v2 net-next 5/5] neighbour: Floor neigh_periodic_work() interval at 1s.
Date: Tue, 13 Oct 2026 20:57:32 +0000 [thread overview]
Message-ID: <20261013205816.1642597-6-kuniyu@google.com> (raw)
In-Reply-To: <20261013205816.1642597-1-kuniyu@google.com>
neigh_periodic_work() reschedules tbl->gc_work with a delay of
BASE_REACHABLE_TIME >> 1.
neigh_table is now per-netns, and a user could hog CPU by setting
BASE_REACHABLE_TIME to a small value.
Unlike INTERVAL_PROBE_TIME_MS, BASE_REACHABLE_TIME is also used to
compute reachable_time for NUD_REACHABLE entries.
Let's floor only the GC interval at 1 second.
Suggested-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/netdev/20260902143023.GA3966681@shredder/
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
net/core/neighbour.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index aa3da886eaab..d6e9c7c59a89 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1042,12 +1042,12 @@ static void neigh_periodic_work(struct work_struct *work)
lockdep_is_held(&tbl->lock));
}
out:
- /* Cycle through all hash buckets every BASE_REACHABLE_TIME/2 ticks.
+ /* Cycle through all hash buckets every max(HZ, BASE_REACHABLE_TIME/2) ticks.
* ARP entry timeouts range from 1/2 BASE_REACHABLE_TIME to 3/2
* BASE_REACHABLE_TIME.
*/
queue_delayed_work(system_power_efficient_wq, &tbl->gc_work,
- NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1);
+ max(HZ, NEIGH_VAR(&tbl->parms, BASE_REACHABLE_TIME) >> 1));
spin_unlock_bh(&tbl->lock);
}
--
2.56.0.385.gd3acb90ef8-goog
prev parent reply other threads:[~2026-10-13 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 20:57 [PATCH v2 net-next 0/5] neighbour: Misc follow-ups on per-netns neigh_table series Kuniyuki Iwashima
2026-10-13 20:57 ` [PATCH v2 net-next 1/5] Documentation: networking: switchdev: Replace arp_tbl with arp_table(net) Kuniyuki Iwashima
2026-10-13 20:57 ` [PATCH v2 net-next 2/5] selftests: netfilter: Set gc_thresh[123] for gw netns in nft_nat_zones.sh Kuniyuki Iwashima
2026-10-13 20:57 ` [PATCH v2 net-next 3/5] neighbour: Schedule neigh_managed_work only when needed Kuniyuki Iwashima
2026-10-13 20:57 ` [PATCH v2 net-next 4/5] neighbour: Floor INTERVAL_PROBE_TIME_MS at 1000 Kuniyuki Iwashima
2026-10-13 20:57 ` Kuniyuki Iwashima [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=20261013205816.1642597-6-kuniyu@google.com \
--to=kuniyu@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--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