teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

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

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