anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

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

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