Blame SOURCES/0659-rules-implement-new-memory-hotplug-policy.patch

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