Thread (8 messages) 8 messages, 2 authors, 8h ago
HOTtoday

[PATCH v1 net-next 1/5] net: Remove net->is_dying.

From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-09-27 20:24:39
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Commit 7acee67a6bce ("netns: optimize netns cleaning by batching
unhash_nsid calls") added the is_dying flag in struct net.

It is an alias of !check_net(net), and having two ways to represent
the same state is confusing.

Let's remove the flag.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
 include/net/net_namespace.h | 1 -
 net/core/net_namespace.c    | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 46b4c67e2966..b4247e767d13 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -125,7 +125,6 @@ struct net {
 	 * it is critical that it is on a read_mostly cache line.
 	 */
 	u32			hash_mix;
-	bool			is_dying;
 
 	struct net_device       *loopback_dev;          /* The loopback */
 
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index da5f881fbd3b..0e13de0cd36b 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -644,7 +644,7 @@ static void unhash_nsid(struct net *last)
 			int curr_id = id;
 
 			id++;
-			if (!peer->is_dying)
+			if (check_net(peer))
 				continue;
 
 			idr_remove(&tmp->netns_ids, curr_id);
@@ -681,7 +681,6 @@ static void cleanup_net(struct work_struct *work)
 	llist_for_each_entry(net, net_kill_list, cleanup_list) {
 		ns_tree_remove(net);
 		list_del_rcu(&net->list);
-		net->is_dying = true;
 	}
 	/* Cache last net. After we unlock rtnl, no one new net
 	 * added to net_namespace_list can assign nsid pointer
-- 
2.56.0.rc1.315.gc6ed9934b7-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help