This change adds a patch to the linux-esx build that removes the
OOM_SCORE_ADJ_MAX limit check. The background as to why we would like to
see this integrated is as follows: We would like to have a canary
process running inside a Photon based VM, with the intention of it being
killed first by Linux when memory pressure is high. Upon encountering
such an OOM kill we can then cleanly shut down the VM.
Unfortunately, vanilla Linux and the hints it arms us with
(oom_score_adj most importantly) was found to be insufficient: the
kernel would still kill processes that actually cause the high memory
pressure first, instead of giving preference to our canary process. With
the patch added as part of this change we effectively allow for setting
a higher priority for the canary process, causing the canary to truly be
the first target. Because we only increase the number of available
priorities, existing workloads are not affected negatively.
Change-Id: I8be7e9f16eb71be684c7eb63482c19f90782866e
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/7768
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Srivatsa S. Bhat <srivatsab@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
0 |
+From a666b331d08a524f6caaf41f57342311e91c5610 Mon Sep 17 00:00:00 2001 |
|
1 |
+From: Daniel Mueller <danielmuller@vmware.com> |
|
2 |
+Date: Thu, 25 Jul 2019 10:15:06 -0700 |
|
3 |
+Subject: [PATCH] Remove OOM_SCORE_ADJ_MAX limit check |
|
4 |
+ |
|
5 |
+This patch removes the OOM_SCORE_ADJ_MAX limit check. By removing this |
|
6 |
+check we are able to adjust the OOM score beyond OOM_SCORE_ADJ_MAX |
|
7 |
+(1000), which provides us with more confidence that the OOM killer will |
|
8 |
+actually choose the target process to be killed before interfering with |
|
9 |
+others. That is useful in certain Photon VM based setups where we want |
|
10 |
+to have a "canary" process that, upon being killed by the OOM, would |
|
11 |
+inform an agent in the VM that we are under memory pressure, and trigger |
|
12 |
+a clean shut down of the VM. |
|
13 |
+With the check in place, the kernel would still favor processes that had |
|
14 |
+a high score (1000 and above) based on actual memory consumption, |
|
15 |
+rendering our approach useless. |
|
16 |
+--- |
|
17 |
+ fs/proc/base.c | 2 +- |
|
18 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
|
19 |
+ |
|
20 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
|
21 |
+index f999e8..089ec0 100644 |
|
22 |
+--- a/fs/proc/base.c |
|
23 |
+@@ -1188,7 +1188,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, |
|
24 |
+ if (err) |
|
25 |
+ goto out; |
|
26 |
+ if (oom_score_adj < OOM_SCORE_ADJ_MIN || |
|
27 |
+- oom_score_adj > OOM_SCORE_ADJ_MAX) { |
|
28 |
++ oom_score_adj > SHRT_MAX) { |
|
29 |
+ err = -EINVAL; |
|
30 |
+ goto out; |
|
31 |
+ } |
|
32 |
+-- |
|
33 |
+2.21.0 |
|
34 |
+ |
... | ... |
@@ -2,7 +2,7 @@ |
2 | 2 |
Summary: Kernel |
3 | 3 |
Name: linux-esx |
4 | 4 |
Version: 4.19.65 |
5 |
-Release: 1%{?dist} |
|
5 |
+Release: 2%{?dist} |
|
6 | 6 |
License: GPLv2 |
7 | 7 |
URL: http://www.kernel.org/ |
8 | 8 |
Group: System Environment/Kernel |
... | ... |
@@ -55,6 +55,7 @@ Patch32: 0001-ip_sockglue-Fix-missing-check-bug-in-ip_ra_control.patch |
55 | 55 |
Patch34: 0001-ipv6_sockglue-Fix-a-missing-check-bug-in-ip6_ra_cont.patch |
56 | 56 |
# Fix for CVE-2019-12455 |
57 | 57 |
Patch35: 0001-clk-sunxi-fix-a-missing-check-bug-in-sunxi_divs_clk_.patch |
58 |
+Patch36: 0001-Remove-OOM_SCORE_ADJ_MAX-limit-check.patch |
|
58 | 59 |
|
59 | 60 |
BuildArch: x86_64 |
60 | 61 |
BuildRequires: bc |
... | ... |
@@ -122,6 +123,7 @@ The Linux package contains the Linux kernel doc files |
122 | 122 |
%patch32 -p1 |
123 | 123 |
%patch34 -p1 |
124 | 124 |
%patch35 -p1 |
125 |
+%patch36 -p1 |
|
125 | 126 |
|
126 | 127 |
%build |
127 | 128 |
# patch vmw_balloon driver |
... | ... |
@@ -219,6 +221,8 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg |
219 | 219 |
/usr/src/linux-headers-%{uname_r} |
220 | 220 |
|
221 | 221 |
%changelog |
222 |
+* Tue Aug 13 2019 Daniel Müller <danielmuller@vmware.com> 4.19.65-2 |
|
223 |
+- Add patch "Remove OOM_SCORE_ADJ_MAX limit check" |
|
222 | 224 |
* Tue Aug 06 2019 Alexey Makhalov <amakhalov@vmware.com> 4.19.65-1 |
223 | 225 |
- Update to version 4.19.65 |
224 | 226 |
- Fix CVE-2019-1125 (SWAPGS) |