Disable CONFIG_MEMCG_KMEM to avoid slab leak

The kernel memory accounting in the RHEL kernel is broken and
results in a slab memory leak when it is enabled. See the
following bug for details:
https://bugzilla.redhat.com/show_bug.cgi?id=1507149

Unfortunately, this option is enabled by default, so it must be
disabled. Even worse, the kernel won't compile with the option
disabled, so a fix for the compile error is also included.

Change-Id: I627106ae25f86204c1954c1c21171bbef348afaf
Closes-Bug: 1835534
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
This commit is contained in:
Bart Wensley 2019-07-08 11:43:37 -05:00
parent 202ad050a8
commit 088fa28ead
8 changed files with 104 additions and 23 deletions

View File

@ -1,4 +1,4 @@
COPY_LIST="files/*"
TIS_PATCH_VER=1
TIS_PATCH_VER=2
BUILD_IS_BIG=11
BUILD_IS_SLOW=12

View File

@ -1,34 +1,36 @@
From 72f81cd0693c1abfdb5d86bf207cfcd3201646d7 Mon Sep 17 00:00:00 2001
Message-Id: <72f81cd0693c1abfdb5d86bf207cfcd3201646d7.1528231893.git.Jim.Somerville@windriver.com>
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Tue, 5 Jun 2018 16:51:28 -0400
From 8fbd0edbcf6ed51b9e58d267d0ce7b40f00118a1 Mon Sep 17 00:00:00 2001
From: Bart Wensley <barton.wensley@windriver.com>
Date: Tue, 9 Jul 2019 07:18:00 -0500
Subject: [PATCH 1/1] Compile issues
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
---
SPECS/kernel-rt.spec | 5 +++++
1 file changed, 5 insertions(+)
SPECS/kernel-rt.spec | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/SPECS/kernel-rt.spec b/SPECS/kernel-rt.spec
index ab6daf3..3c0e4b4 100644
index 3b7985c..5025db7 100644
--- a/SPECS/kernel-rt.spec
+++ b/SPECS/kernel-rt.spec
@@ -418,6 +418,9 @@ Patch1027: dpt_i2o-fix-build-warning.patch
@@ -418,6 +418,11 @@ Patch1027: dpt_i2o-fix-build-warning.patch
# DRBD was choking on write same
Patch1028: turn-off-write-same-in-smartqpi-driver.patch
Patch1029: restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch
+Patch1030: fix-compilation-issues.patch
+# Fix CentOS 7.6 upgrade compile error
+Patch1031: fix-CentOS-7.6-upgrade-compile-error.patch
+# Compile fix for disabling CONFIG_MEMCG_KMEM
+Patch1032: compile-fix-for-disabling-CONFIG_MEMCG_KMEM.patch
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -780,6 +783,8 @@ ApplyPatch aic94xx-Skip-reading-user-settings-if-flash-is-not-f.patch
@@ -780,6 +785,9 @@ ApplyPatch aic94xx-Skip-reading-user-settings-if-flash-is-not-f.patch
ApplyPatch dpt_i2o-fix-build-warning.patch
ApplyPatch turn-off-write-same-in-smartqpi-driver.patch
ApplyPatch restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch
+ApplyPatch fix-compilation-issues.patch
+ApplyPatch fix-CentOS-7.6-upgrade-compile-error.patch
+ApplyPatch compile-fix-for-disabling-CONFIG_MEMCG_KMEM.patch
# move off upstream version mechanism
if [ -e localversion-rt ]; then

View File

@ -0,0 +1,35 @@
From a209e9637eacb353adb97f29dd059e63084d30df Mon Sep 17 00:00:00 2001
From: Bart Wensley <barton.wensley@windriver.com>
Date: Tue, 9 Jul 2019 07:25:32 -0500
Subject: [PATCH 1/1] compile fix for disabling CONFIG_MEMCG_KMEM
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
---
mm/memcontrol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index da97e2c..68fd46b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3010,6 +3010,8 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg,
memcg_check_events(memcg, page);
}
+static DEFINE_MUTEX(memcg_limit_mutex);
+
#ifdef CONFIG_MEMCG_KMEM
static inline bool memcg_can_account_kmem(struct mem_cgroup *memcg)
{
@@ -3510,8 +3512,6 @@ out:
return new_cachep;
}
-static DEFINE_MUTEX(memcg_limit_mutex);
-
int __kmem_cache_destroy_memcg_children(struct kmem_cache *s)
{
struct kmem_cache *c;
--
1.8.3.1

View File

@ -956,3 +956,6 @@ CONFIG_TORTURE_TEST=n
CONFIG_RCU_TORTURE_TEST=n
CONFIG_LOCK_TORTURE_TEST=n
# Disable kernel memory accounting, which is broken
CONFIG_MEMCG_KMEM=n

View File

@ -1,4 +1,4 @@
COPY_LIST="files/*"
TIS_PATCH_VER=1
TIS_PATCH_VER=2
BUILD_IS_BIG=11
BUILD_IS_SLOW=12

View File

@ -1,18 +1,18 @@
From 0bdbfc48c66177522eae9bb7c0449f39f418e609 Mon Sep 17 00:00:00 2001
From: Jim Somerville <Jim.Somerville@windriver.com>
Date: Wed, 30 May 2018 13:12:03 -0400
Subject: [PATCH 4/5] Compile issues
From 6b9579fcfb774f20f114ebc621a925d35d3aa034 Mon Sep 17 00:00:00 2001
From: Bart Wensley <barton.wensley@windriver.com>
Date: Tue, 9 Jul 2019 06:36:33 -0500
Subject: [PATCH 1/1] Compile issues
Signed-off-by: Jim Somerville <Jim.Somerville@windriver.com>
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
---
SPECS/kernel.spec | 6 ++++++
1 file changed, 6 insertions(+)
SPECS/kernel.spec | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec
index 01dd989..d45c419 100644
index 3f774c2..b69967d 100644
--- a/SPECS/kernel.spec
+++ b/SPECS/kernel.spec
@@ -489,6 +489,10 @@ Patch40024: aic94xx-Skip-reading-user-settings-if-flash-is-not-f.patch
@@ -489,6 +489,12 @@ Patch40024: aic94xx-Skip-reading-user-settings-if-flash-is-not-f.patch
Patch40025: dpt_i2o-fix-build-warning.patch
# DRBD was choking on write same
Patch40026: turn-off-write-same-in-smartqpi-driver.patch
@ -20,18 +20,21 @@ index 01dd989..d45c419 100644
+Patch40027: fix-compilation-issues.patch
+# Fix CentOS 7.6 upgrade compile error
+Patch40028: fix-CentOS-7.6-upgrade-compile-error.patch
+# Compile fix for disabling CONFIG_MEMCG_KMEM
+Patch40029: compile-fix-for-disabling-CONFIG_MEMCG_KMEM.patch
BuildRoot: %{_tmppath}/kernel-%{KVRA}-root
@@ -859,6 +863,8 @@ ApplyOptionalPatch US103091-IMA-System-Configuration.patch
@@ -859,6 +865,9 @@ ApplyOptionalPatch US103091-IMA-System-Configuration.patch
ApplyOptionalPatch aic94xx-Skip-reading-user-settings-if-flash-is-not-f.patch
ApplyOptionalPatch dpt_i2o-fix-build-warning.patch
ApplyOptionalPatch turn-off-write-same-in-smartqpi-driver.patch
+ApplyOptionalPatch fix-compilation-issues.patch
+ApplyOptionalPatch fix-CentOS-7.6-upgrade-compile-error.patch
+ApplyOptionalPatch compile-fix-for-disabling-CONFIG_MEMCG_KMEM.patch
# Any further pre-build tree manipulations happen here.
--
2.7.4
1.8.3.1

View File

@ -0,0 +1,35 @@
From 66936b9bfda2fa11019bf45298047c7365fdacb4 Mon Sep 17 00:00:00 2001
From: Bart Wensley <barton.wensley@windriver.com>
Date: Mon, 8 Jul 2019 13:32:44 -0500
Subject: [PATCH 1/1] compile fix for disabling CONFIG_MEMCG_KMEM
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
---
mm/memcontrol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 175fef9..e475427 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3007,6 +3007,8 @@ static void __mem_cgroup_commit_charge(struct mem_cgroup *memcg,
memcg_check_events(memcg, page);
}
+static DEFINE_MUTEX(memcg_limit_mutex);
+
#ifdef CONFIG_MEMCG_KMEM
static inline bool memcg_can_account_kmem(struct mem_cgroup *memcg)
{
@@ -3507,8 +3509,6 @@ out:
return new_cachep;
}
-static DEFINE_MUTEX(memcg_limit_mutex);
-
int __kmem_cache_destroy_memcg_children(struct kmem_cache *s)
{
struct kmem_cache *c;
--
1.8.3.1

View File

@ -811,3 +811,6 @@ CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=n
# Make performance default governor
CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=n
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# Disable kernel memory accounting, which is broken
CONFIG_MEMCG_KMEM=n