diff options
| author | Kuniyuki Iwashima <kuniyu@google.com> | 2026-10-13 20:57:32 +0000 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-20 11:57:08 -0700 |
| commit | ccd0742641dcbfd7ceab49fba841211be204e12b (patch) | |
| tree | 152ded57fcd8f7737e7218e687b9eac94705b3b5 /net/core | |
| parent | 7a71343ba1a69fee4c50fad47c62c6acbd454492 (diff) | |
neighbour: Floor neigh_periodic_work() interval at 1s.
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>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20261013205816.1642597-6-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
| -rw-r--r-- | net/core/neighbour.c | 4 |
1 files 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); } |
