unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#64260] [PATCH] Use cgroups v2 file system
@ 2023-06-24  3:11 Sam Lockart
  2023-07-05 20:52 ` Brian Cully via Guix-patches via
  2023-08-08 15:08 ` bug#64260: " Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Sam Lockart @ 2023-06-24  3:11 UTC (permalink / raw)
  To: 64260

cgroup v2 is the next generation of the control groups API.
This patch replaces the cgroup v1 file system with the unified
cgroup v2 file system.

cgroup v2 allows for things like containerd/podman to run rootless containers and opens guix system up to running things like Kubernetes.

* gnu/system/file-systems.scm: Use cgroups v2 file system
---
 gnu/system/file-systems.scm | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 0ff5a0dcf6..59e04bcecf 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -445,26 +445,13 @@ (define %immutable-store
     (flags '(read-only bind-mount no-atime))))
 
 (define %control-groups
-  (let ((parent (file-system
-                  (device "cgroup")
-                  (mount-point "/sys/fs/cgroup")
-                  (type "tmpfs")
-                  (check? #f))))
-    (cons parent
-          (map (lambda (subsystem)
-                 (file-system
-                   (device "cgroup")
-                   (mount-point (string-append "/sys/fs/cgroup/" subsystem))
-                   (type "cgroup")
-                   (check? #f)
-                   (options subsystem)
-                   (create-mount-point? #t)
-
-                   ;; This must be mounted after, and unmounted before the
-                   ;; parent directory.
-                   (dependencies (list parent))))
-               '("cpuset" "cpu" "cpuacct" "memory" "devices" "freezer"
-                 "blkio" "perf_event" "pids")))))
+  ;; The cgroup2 file system.
+  (list (file-system
+           (device "none")
+	   (mount-point "/sys/fs/cgroup")
+	   (type "cgroup2")
+	   (check? #f)
+	   (create-mount-point? #f))))
 
 (define %elogind-file-systems
   ;; We don't use systemd, but these file systems are needed for elogind,
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#64260] [PATCH] Use cgroups v2 file system
  2023-06-24  3:11 [bug#64260] [PATCH] Use cgroups v2 file system Sam Lockart
@ 2023-07-05 20:52 ` Brian Cully via Guix-patches via
  2023-08-02  4:39   ` Hilton Chain via Guix-patches via
  2023-08-08 15:08 ` bug#64260: " Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Cully via Guix-patches via @ 2023-07-05 20:52 UTC (permalink / raw)
  To: Sam Lockart; +Cc: 64260

I've been running this patch for a few days with an elogind-based system
and haven't had any issues. This patch also fixes rootless podman with
elogind, which is very nice.

-bjc




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#64260] [PATCH] Use cgroups v2 file system
  2023-07-05 20:52 ` Brian Cully via Guix-patches via
@ 2023-08-02  4:39   ` Hilton Chain via Guix-patches via
  0 siblings, 0 replies; 4+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-08-02  4:39 UTC (permalink / raw)
  To: Brian Cully; +Cc: Sam Lockart, 64260

Hi,

On Thu, 06 Jul 2023 04:52:34 +0800,
Brian Cully via Guix-patches via wrote:
>
> I've been running this patch for a few days with an elogind-based system
> and haven't had any issues. This patch also fixes rootless podman with
> elogind, which is very nice.
>
> -bjc

I'm not familiar with cgroup, but the current %control-groups is
a requirement for docker-shepherd-service:
--8<---------------cut here---------------start------------->8---
(shepherd-service
       (documentation "Docker daemon.")
       (provision '(dockerd))
       (requirement '(containerd
                      dbus-system
                      elogind
                      file-system-/sys/fs/cgroup/blkio
                      file-system-/sys/fs/cgroup/cpu
                      file-system-/sys/fs/cgroup/cpuset
                      file-system-/sys/fs/cgroup/devices
                      file-system-/sys/fs/cgroup/memory
                      file-system-/sys/fs/cgroup/pids
                      networking
                      udev))
--8<---------------cut here---------------end--------------->8---

Thanks




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#64260: [PATCH] Use cgroups v2 file system
  2023-06-24  3:11 [bug#64260] [PATCH] Use cgroups v2 file system Sam Lockart
  2023-07-05 20:52 ` Brian Cully via Guix-patches via
@ 2023-08-08 15:08 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2023-08-08 15:08 UTC (permalink / raw)
  To: Sam Lockart; +Cc: 64260-done

Hello Sam,

Sam Lockart <sam@samlockart.com> skribis:

> cgroup v2 is the next generation of the control groups API.
> This patch replaces the cgroup v1 file system with the unified
> cgroup v2 file system.
>
> cgroup v2 allows for things like containerd/podman to run rootless containers and opens guix system up to running things like Kubernetes.
>
> * gnu/system/file-systems.scm: Use cgroups v2 file system

[...]

Hilton Chain <hako@ultrarare.space> skribis:

> I'm not familiar with cgroup, but the current %control-groups is
> a requirement for docker-shepherd-service:

Good point!  Finally applied, with the change Hilton suggested.

This passes just fine:

  make check-system TESTS="docker basic elogind"

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-08 15:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-24  3:11 [bug#64260] [PATCH] Use cgroups v2 file system Sam Lockart
2023-07-05 20:52 ` Brian Cully via Guix-patches via
2023-08-02  4:39   ` Hilton Chain via Guix-patches via
2023-08-08 15:08 ` bug#64260: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).