Skip to contentSkip to conversation

package/systemd: enable required oomd kernel options

PATCH Superseded James Hilliard 2 participants 4 messages Jul 3, 2024 – Jul 12, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemd: enable required oomd kernel options

In order for systemd-oomd to run CONFIG_PSI and CONFIG_MEMCG must be enabled in the kernel config.

---
 package/systemd/systemd.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/systemd/systemd.mk +6 -0
index 6b3553723c..52fa344807 100644
@@ -480,6 +480,10 @@ endif
 ifeq ($(BR2_PACKAGE_SYSTEMD_OOMD),y)
 SYSTEMD_CONF_OPTS += -Doomd=true
 SYSTEMD_OOMD_USER = systemd-oom -1 systemd-oom -1 * - - - systemd Userspace OOM Killer
+define SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PSI)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+endef
 else
 SYSTEMD_CONF_OPTS += -Doomd=false
 endif
@@ -804,6 +808,8 @@ define SYSTEMD_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
+
+	$(SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS)
 endef
 
 # We need a very minimal host variant, so we disable as much as possible.
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello James,

Le 03/07/2024 à 21:03, James Hilliard a écrit :

Quoted 2 lines

In order for systemd-oomd to run CONFIG_PSI and CONFIG_MEMCG must be enabled in the kernel config.

Maybe a link to the upstream documentation would help to review this change:

https://github.com/systemd/systemd/commit/e7b3f1a6c358dd3eaf0b50547bd52130ad4126ae

https://github.com/systemd/systemd/commit/aa329b89223a79793cde8288b1bc6e93db174938

Quoted 11 lines
---
 package/systemd/systemd.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/systemd/systemd.mk +0 -0
index 6b3553723c..52fa344807 100644

package/systemd/systemd.mk endif · line 483

Quoted 4 lines
package/systemd/systemd.mk +1 -0
@@ -480,6 +480,10 @@ endif
 ifeq ($(BR2_PACKAGE_SYSTEMD_OOMD),y)
 SYSTEMD_CONF_OPTS += -Doomd=true
 SYSTEMD_OOMD_USER = systemd-oom -1 systemd-oom -1 * - - - systemd Userspace OOM Killer
+define SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS

Don't use _LINUX_CONFIG_FIXUPS here to avoid any confusion with SYSTEMD_LINUX_CONFIG_FIXUPS. Also _LINUX_CONFIG_FIXUPS suffix could be handled by the generic package infrastructure if systemd-oomd package is added later by someone.

package/systemd/systemd.mk define SYSTEMD_LINUX_CONFIG_FIXUPS · line 811

Quoted 11 lines
package/systemd/systemd.mk +4 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PSI)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+endef
 else
 SYSTEMD_CONF_OPTS += -Doomd=false
 endif
@@ -804,6 +808,8 @@ define SYSTEMD_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
 	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
+

I'm not sure about this new line.

Best regards,
Romain

package/systemd/systemd.mk define SYSTEMD_LINUX_CONFIG_FIXUPS · line 815

Quoted 4 lines
package/systemd/systemd.mk +1 -0
+	$(SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS)
 endef
 
 # We need a very minimal host variant, so we disable as much as possible.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 18 lines · Romain Naour via buildroot

Hello James,

Le 03/07/2024 à 21:03, James Hilliard a écrit :

Quoted 2 lines

In order for systemd-oomd to run CONFIG_PSI and CONFIG_MEMCG must be enabled in the kernel config.

Maybe a link to the upstream documentation would help to review this change:

https://github.com/systemd/systemd/commit/e7b3f1a6c358dd3eaf0b50547bd52130ad4126ae

https://github.com/systemd/systemd/commit/aa329b89223a79793cde8288b1bc6e93db174938

Quoted 6 lines
---
  package/systemd/systemd.mk | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 12 lines

package/systemd/systemd.mk endif · line 483

Quoted 9 lines
package/systemd/systemd.mk +1 -0
index 6b3553723c..52fa344807 100644
@@ -480,6 +480,10 @@ endif
  ifeq ($(BR2_PACKAGE_SYSTEMD_OOMD),y)
  SYSTEMD_CONF_OPTS += -Doomd=true
  SYSTEMD_OOMD_USER = systemd-oom -1 systemd-oom -1 * - - - systemd Userspace OOM Killer
+define SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS

Don't use _LINUX_CONFIG_FIXUPS here to avoid any confusion with SYSTEMD_LINUX_CONFIG_FIXUPS.

Well, we somehow need to append these fixups to SYSTEMD_LINUX_CONFIG_FIXUPS,
and there's no += equivalent for multiline variables. So defining a helper variable that is later included in SYSTEMD_LINUX_CONFIG_FIXUPS is the cleanest way to do it.

Quoted 3 lines

Also _LINUX_CONFIG_FIXUPS suffix could be handled
by the generic package infrastructure if systemd-oomd package is added later by someone.

Uh, yes, but that would imply that this condition needs to be moved out of
systemd.mk and into systemd-oomd.mk, so I don't see what the problem is? Anyway, I don't think we need to consider the unlikely future of someone breaking the systemd package into separate packages.

(Or perhaps you meant, if someone would implement a completely unrelated
systemd-oomd package. That would be impossible, because BR2_PACKAGE_SYSTEMD_OOMD is already defined in systemd's Config.in.)

So (with the additional links to documentation) I think this patch is good as-is.

Regards,
Arnout

Quoted 22 lines

package/systemd/systemd.mk define SYSTEMD_LINUX_CONFIG_FIXUPS · line 811

Quoted 12 lines
package/systemd/systemd.mk +4 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_PSI)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+endef
  else
  SYSTEMD_CONF_OPTS += -Doomd=false
  endif
@@ -804,6 +808,8 @@ define SYSTEMD_LINUX_CONFIG_FIXUPS
  	$(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
  	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
  	$(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
+

I'm not sure about this new line.

Best regards,
Romain

Quoted 3 lines
package/systemd/systemd.mk +1 -0
+	$(SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS)
  endef
 
Quoted 6 lines

package/systemd/systemd.mk define SYSTEMD_LINUX_CONFIG_FIXUPS · line 815

Quoted 1 line
package/systemd/systemd.mk +0 -0
  # We need a very minimal host variant, so we disable as much as possible.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hello Arnout, James,

Le 04/07/2024 à 22:27, Arnout Vandecappelle a écrit :

Quoted 49 lines · Romain Naour via buildroot
Quoted 18 lines

Hello James,

Le 03/07/2024 à 21:03, James Hilliard a écrit :

Quoted 2 lines

In order for systemd-oomd to run CONFIG_PSI and CONFIG_MEMCG must be enabled in the kernel config.

Maybe a link to the upstream documentation would help to review this change:

https://github.com/systemd/systemd/commit/e7b3f1a6c358dd3eaf0b50547bd52130ad4126ae

https://github.com/systemd/systemd/commit/aa329b89223a79793cde8288b1bc6e93db174938

Quoted 6 lines

---
  package/systemd/systemd.mk | 6 ++++++

  1 file changed, 6 insertions(+)
Quoted 13 lines
Quoted 10 lines
package/systemd/systemd.mk +0 -0
index 6b3553723c..52fa344807 100644
@@ -480,6 +480,10 @@ endif
   ifeq ($(BR2_PACKAGE_SYSTEMD_OOMD),y)

  SYSTEMD_CONF_OPTS += -Doomd=true
  SYSTEMD_OOMD_USER = systemd-oom -1 systemd-oom -1 * - - - systemd Userspace OOM Killer
+define SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS

Don't use _LINUX_CONFIG_FIXUPS here to avoid any confusion with SYSTEMD_LINUX_CONFIG_FIXUPS.

 Well, we somehow need to append these fixups to SYSTEMD_LINUX_CONFIG_FIXUPS, and there's no += equivalent for multiline variables. So defining a helper variable that is later included in SYSTEMD_LINUX_CONFIG_FIXUPS is the cleanest way to do it.

Quoted 3 lines

Also _LINUX_CONFIG_FIXUPS suffix could be handled
by the generic package infrastructure if systemd-oomd package is added later by someone.

 Uh, yes, but that would imply that this condition needs to be moved out of systemd.mk and into systemd-oomd.mk, so I don't see what the problem is? Anyway, I don't think we need to consider the unlikely future of someone breaking the systemd package into separate packages.

Quoted 5 lines

 (Or perhaps you meant, if someone would implement a completely unrelated systemd-oomd package. That would be impossible, because BR2_PACKAGE_SYSTEMD_OOMD is already defined in systemd's Config.in.)

 So (with the additional links to documentation) I think this patch is good as-is.

Ok, you're right.

Best regards,
Romain

Quoted 31 lines

 Regards,
 Arnout

Quoted 27 lines

package/systemd/systemd.mk define SYSTEMD_LINUX_CONFIG_FIXUPS · line 811

Quoted 12 lines

+    $(call KCONFIG_ENABLE_OPT,CONFIG_PSI)
+    $(call KCONFIG_ENABLE_OPT,CONFIG_MEMCG)
+endef
  else
  SYSTEMD_CONF_OPTS += -Doomd=false
  endif

package/systemd/systemd.mk +1 -0
@@ -804,6 +808,8 @@ define SYSTEMD_LINUX_CONFIG_FIXUPS
       $(call KCONFIG_ENABLE_OPT,CONFIG_AUTOFS4_FS)
       $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_POSIX_ACL)
       $(call KCONFIG_ENABLE_OPT,CONFIG_TMPFS_XATTR)
+

I'm not sure about this new line.

Best regards,
Romain

Quoted 3 lines
package/systemd/systemd.mk +1 -0
+    $(SYSTEMD_OOMD_LINUX_CONFIG_FIXUPS)

  endef
    # We need a very minimal host variant, so we disable as much as possible.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot