[CRIU] [PATCH v3 17/55] pid: Add ns::pid::rb_root

Kirill Tkhai ktkhai at virtuozzo.com
Mon Apr 10 01:17:51 PDT 2017


Add a per-ns rb tree to link pids. Should replace global pid_root_rb.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/namespaces.h |    3 +++
 criu/namespaces.c         |    4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index 922528c2a..8cdcd2651 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -149,6 +149,9 @@ struct ns_id {
 			UsernsEntry *e;
 			int nsfd_id;
 		} user;
+		struct {
+			struct rb_root rb_root;
+		} pid;
 	};
 };
 extern struct ns_id *ns_ids;
diff --git a/criu/namespaces.c b/criu/namespaces.c
index f671ddfd9..6dc0f0f2d 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -310,7 +310,8 @@ struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid,
 			INIT_LIST_HEAD(&nsid->net.ids);
 			INIT_LIST_HEAD(&nsid->net.links);
 			nsid->net.netns = NULL;
-		}
+		} else if (nd == &pid_ns_desc)
+			nsid->pid.rb_root = RB_ROOT;
 	}
 
 	return nsid;
@@ -436,6 +437,7 @@ static unsigned int generate_ns_id(int pid, unsigned int kid, struct ns_desc *nd
 		INIT_LIST_HEAD(&nsid->net.ids);
 		INIT_LIST_HEAD(&nsid->net.links);
 	} else if (nd == &pid_ns_desc) {
+		nsid->pid.rb_root = RB_ROOT;
 		if (type == NS_ROOT || (type == NS_CRIU && !top_pid_ns))
 			top_pid_ns = nsid;
 	}



More information about the CRIU mailing list