From 4fe3acd9e1197554001a93d61d4ec65a0b19745e Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 19 May 2020 21:41:08 +0200 Subject: [PATCH] clone.2: Note a performance benefit of CLONE_INTO_CGROUP As noted in email by Christian Brauner: I forgot to mention that spawning directly into a target cgroup is also more efficient than moving it after creation. The specific reason is mentioned in the commit message [ef2c41cf38a], the write lock of the semaphore need not be taken in contrast to when it is moved afterwards. That implementation details is not that interesting but it might be interesting to know that it provides performance benefits in general. Reported-by: Christian Brauner Signed-off-by: Michael Kerrisk --- man2/clone.2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man2/clone.2 b/man2/clone.2 index a0de831dee..69325ef83c 100644 --- a/man2/clone.2 +++ b/man2/clone.2 @@ -571,6 +571,9 @@ This eliminates the accounting jitter that would be caused if the child process was first created in the same cgroup as the parent and then moved into the target cgroup. +Furthermore, spawning the child process directly into a target cgroup +is significantly cheaper than moving the child process into +the target cgroup after it has been created. .IP * The .BR CLONE_INTO_CGROUP -- 2.39.2