File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -718,3 +718,21 @@ point that out explicitly and clearly in the associated patches and Cc
718718 since btrfs places files all over the backing store, and thus the
719719 shrinking will generate a lot of nonsensical IO that could be
720720 reduced if the file system was always kept minimal in size anyway.
721+
722+ * Add process by PIDFD to a cgroup
723+
724+ At the moment the canonical way to add a process to a cgroup is by
725+ echoing its PID into the ` cgroup.procs ` attribute in the target
726+ cgroupfs directory of the cgroup. This is safe as long as the
727+ process doing so just forked off the process it wants to migrate and
728+ hence can control that it hasn't been reaped yet, and hence
729+ guarantees the PID is valid. This is racy however if "foreign"
730+ processes shall be moved into the cgroup.
731+
732+ ** Usecase:** In systemd, all user sessions are wrapped in scope
733+ units which are backed by a cgroup. The session processes moved into
734+ the scope unit are typically "foreign" processes, i.e. not children
735+ of the service manager, hence doing the movement is subject to races
736+ in case the process dies and its PID is quickly recycled. (This
737+ assumes systemd can acquire a pidfd of the foreign process without
738+ races, for example via ` SCM_PIDFD ` and ` SO_PEERPIDFD ` or similar.)
You can’t perform that action at this time.
0 commit comments