daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
aed857
From c50b7bcbebcfebfce3a7e7fb77f88f4b590fb2b5 Mon Sep 17 00:00:00 2001
aed857
From: Michal Sekletar <msekleta@redhat.com>
aed857
Date: Thu, 16 Aug 2018 09:31:51 +0000
aed857
Subject: [PATCH] rules: implement new memory hotplug policy
aed857
aed857
Our new policy is based on following motivations (assumptions),
aed857
  * we want to allow the system to use hotplugged memory
aed857
  * we want memory ballon inflation to work as expected in VMs (going for small
aed857
  to big in terms of memory footprint)
aed857
  * we want to allow memory hotplug and memory hot-unplug on high-end
aed857
  enterprise server (we assume that node0 will have sufficient memory
aed857
  resources and marking all memory as movable shouldn't be a problem)
aed857
aed857
Policy:
aed857
  * nevert online memory on s390 (on both physical and z/VM)
aed857
  * mark memory as "online_movable" on physical machines
aed857
  * mark memory as "online" in VMs
aed857
aed857
If you have the feeling that all this is very wrong and we shouldn't
aed857
encode complex policies in udev rules you are absolutely right. However,
aed857
for now, we don't have any better place where to put it. In ideal world
aed857
we would have a user-space daemon that would be able to configure the
aed857
system wrt. to currently present HW and user-defined policy.
aed857
aed857
Resolves: #1614686
aed857
---
aed857
 rules/40-redhat.rules | 9 ++++++++-
aed857
 1 file changed, 8 insertions(+), 1 deletion(-)
aed857
aed857
diff --git a/rules/40-redhat.rules b/rules/40-redhat.rules
aed857
index 34a1df9c4..1b10e173d 100644
aed857
--- a/rules/40-redhat.rules
aed857
+++ b/rules/40-redhat.rules
aed857
@@ -4,7 +4,14 @@
aed857
 SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
aed857
 
aed857
 # Memory hotadd request
aed857
-SUBSYSTEM=="memory", ACTION=="add", PROGRAM="/bin/uname -p", RESULT!="s390*", ATTR{state}=="offline", ATTR{state}="online"
aed857
+SUBSYSTEM!="memory", ACTION!="add", GOTO="memory_hotplug_end"
aed857
+PROGRAM="/bin/uname -p", RESULT=="s390*", GOTO="memory_hotplug_end"
aed857
+
aed857
+ENV{.state}="online"
aed857
+PROGRAM="/bin/systemd-detect-virt", RESULT=="none", ENV{.state}="online_movable"
aed857
+ATTR{state}=="offline", ATTR{state}="$env{.state}"
aed857
+
aed857
+LABEL="memory_hotplug_end"
aed857
 
aed857
 # reload sysctl.conf / sysctl.conf.d settings when the bridge module is loaded
aed857
 ACTION=="add", SUBSYSTEM=="module", KERNEL=="bridge", RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/proc/sys/net/bridge"