From: Ido Schimmel <idosch@nvidia.com>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH v3 net-next 00/15] neighbour: Namespacify arp_tbl and nd_tbl.
Date: Wed, 12 Aug 2026 11:03:28 +0300 [thread overview]
Message-ID: <20260812080328.GA3281318@shredder> (raw)
In-Reply-To: <CAAVpQUCiW3pPVBCXJjtpqmfkiX496YiMwjpQxx3R8oqpupLvCg@mail.gmail.com>
On Tue, Aug 11, 2026 at 11:39:36AM -0700, Kuniyuki Iwashima wrote:
> On Tue, Aug 11, 2026 at 9:55 AM Ido Schimmel <idosch@nvidia.com> wrote:
> > Another thing worth a discussion is the policy regarding the initial
> > values in each namespace. With this patchset, new namespaces all get the
> > same default values instead of inheriting from the initial namespace:
> >
> > # sysctl net.ipv4.neigh.default.gc_thresh1
> > net.ipv4.neigh.default.gc_thresh1 = 128
> > # sysctl -wq net.ipv4.neigh.default.gc_thresh1=129
> > # ip netns add ns1
> > # ip netns exec ns1 sysctl net.ipv4.neigh.default.gc_thresh1
> > net.ipv4.neigh.default.gc_thresh1 = 128
> >
> > Assuming that today people configure the initial namespace before
> > creating namespaces, changing the policy to inherit from the initial
> > namespace will probably result in fewer regression reports. There is a
> > knob that controls this policy for other settings (see
> > devconf_inherit_init_net).
>
> I considered adding a new knob like tcp_chlid_ehash_entries to
> control the behaviour, but I was wondering if it might be rather
> confusing to people in the future that only GC attributes are inherited.
> But I don't have strong preference here.
Why only GC attributes and not all the default parameters? IOW,
everything under /proc/sys/net/ipv{4,6}/neigh/default/. Something like
[1]. With it, I get:
# sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 128
# sysctl net.ipv4.neigh.default.base_reachable_time_ms
net.ipv4.neigh.default.base_reachable_time_ms = 30000
# sysctl -wq net.ipv4.neigh.default.gc_thresh1=129
# sysctl -wq net.ipv4.neigh.default.base_reachable_time_ms=40000
# ip netns add ns1
# ip netns exec ns1 sysctl net.ipv4.neigh.default.gc_thresh1
net.ipv4.neigh.default.gc_thresh1 = 129
# ip netns exec ns1 sysctl net.ipv4.neigh.default.base_reachable_time_ms
net.ipv4.neigh.default.base_reachable_time_ms = 40000
I think that's closer to the existing behavior. We can add something
like net.core.neigh_inherit_init_net to make the policy configurable:
0 - Use default values.
1 - Inherit from initial network namespace. Default.
[1]
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 07c62268fc3b..0b55baecc55c 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1913,6 +1913,22 @@ static void neigh_table_clear(struct net *net, struct neigh_table *tbl)
neigh_table_put(tbl);
}
+static void neigh_table_inherit(struct net *net, struct neigh_table *tbl,
+ int index)
+{
+ const struct neigh_table *init_tbl = init_net.neigh_tables[index];
+
+ if (net_eq(net, &init_net))
+ return;
+
+ tbl->gc_interval = READ_ONCE(init_tbl->gc_interval);
+ tbl->gc_thresh1 = READ_ONCE(init_tbl->gc_thresh1);
+ tbl->gc_thresh2 = READ_ONCE(init_tbl->gc_thresh2);
+ tbl->gc_thresh3 = READ_ONCE(init_tbl->gc_thresh3);
+
+ memcpy(tbl->parms.data, init_tbl->parms.data, sizeof(tbl->parms.data));
+}
+
int neigh_table_register(struct net *net, struct neigh_table *tbl, int index)
{
int err;
@@ -1923,6 +1939,9 @@ int neigh_table_register(struct net *net, struct neigh_table *tbl, int index)
goto err;
}
+ /* Must be called before neigh_table_init(). */
+ neigh_table_inherit(net, tbl, index);
+
err = neigh_table_init(net, tbl);
if (err)
goto free_table;
prev parent reply other threads:[~2026-08-12 8:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 2:23 [PATCH v3 net-next 00/15] neighbour: Namespacify arp_tbl and nd_tbl Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 01/15] selftest: net: Deflake Periodic GC test in test_neigh.sh Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 02/15] neighbour: Remove __neigh_for_each_release() Kuniyuki Iwashima
2026-08-11 14:27 ` David Ahern
2026-08-11 2:23 ` [PATCH v3 net-next 03/15] neighbour: Remove lock dance for neigh_update_{gc,managed}_list() Kuniyuki Iwashima
2026-08-11 14:34 ` David Ahern
2026-08-11 2:23 ` [PATCH v3 net-next 04/15] neighbour: Remove unnecessary EXPORT_SYMBOL() Kuniyuki Iwashima
2026-08-11 14:28 ` David Ahern
2026-08-11 2:23 ` [PATCH v3 net-next 05/15] neighbour: Remove __rcu from neigh_tables[] Kuniyuki Iwashima
2026-08-11 14:42 ` David Ahern
2026-08-12 3:43 ` Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 06/15] neighbour: Store arp_tbl and nd_tbl in net->neigh_tables[] Kuniyuki Iwashima
2026-08-11 15:19 ` David Ahern
2026-08-11 16:06 ` Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 07/15] neighbour: Remove neigh_tables[] Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 08/15] ipv4: Replace &arp_tbl with arp_table(net) Kuniyuki Iwashima
2026-08-11 12:31 ` Nikolay Aleksandrov
2026-08-11 15:42 ` David Ahern
2026-08-11 16:10 ` Kuniyuki Iwashima
2026-08-11 16:25 ` David Ahern
2026-08-11 16:32 ` Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 09/15] ipv6: Replace &nd_tbl with nd_table(net) Kuniyuki Iwashima
2026-08-11 13:07 ` Nikolay Aleksandrov
2026-08-11 2:23 ` [PATCH v3 net-next 10/15] neighbour: Clean up neigh_table_init() and neigh_table_clear() Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 11/15] neighbour: Convert neigh_table.entries to refcount_t Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 12/15] neighbour: Namespacify neigh_tables Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 13/15] neighbour: Don't store net in struct pneigh_entry Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 14/15] neighbour: Remove unnecessary net_eq() Kuniyuki Iwashima
2026-08-11 2:23 ` [PATCH v3 net-next 15/15] selftest: net: Specify netns for ip ntable in test_neigh.sh Kuniyuki Iwashima
2026-08-11 16:54 ` [PATCH v3 net-next 00/15] neighbour: Namespacify arp_tbl and nd_tbl Ido Schimmel
2026-08-11 18:39 ` Kuniyuki Iwashima
2026-08-12 8:03 ` Ido Schimmel [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=20260812080328.GA3281318@shredder \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=kuniyu@google.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