]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.1/kselftest-cgroup-fix-unexpected-testing-failure-on-t.patch
fixes for 5.1
[thirdparty/kernel/stable-queue.git] / queue-5.1 / kselftest-cgroup-fix-unexpected-testing-failure-on-t.patch
1 From 9ecc7352076c50b6843537a5d984c060125d108a Mon Sep 17 00:00:00 2001
2 From: Alex Shi <alex.shi@linux.alibaba.com>
3 Date: Mon, 27 May 2019 14:28:05 +0800
4 Subject: kselftest/cgroup: fix unexpected testing failure on test_memcontrol
5
6 [ Upstream commit f6131f28057d4fd8922599339e701a2504e0f23d ]
7
8 The cgroup testing relies on the root cgroup's subtree_control setting,
9 If the 'memory' controller isn't set, all test cases will be failed
10 as following:
11
12 $ sudo ./test_memcontrol
13 not ok 1 test_memcg_subtree_control
14 not ok 2 test_memcg_current
15 ok 3 # skip test_memcg_min
16 not ok 4 test_memcg_low
17 not ok 5 test_memcg_high
18 not ok 6 test_memcg_max
19 not ok 7 test_memcg_oom_events
20 ok 8 # skip test_memcg_swap_max
21 not ok 9 test_memcg_sock
22 not ok 10 test_memcg_oom_group_leaf_events
23 not ok 11 test_memcg_oom_group_parent_events
24 not ok 12 test_memcg_oom_group_score_events
25
26 To correct this unexpected failure, this patch write the 'memory' to
27 subtree_control of root to get a right result.
28
29 Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
30 Cc: Shuah Khan <shuah@kernel.org>
31 Cc: Roman Gushchin <guro@fb.com>
32 Cc: Tejun Heo <tj@kernel.org>
33 Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
34 Cc: Jay Kamat <jgkamat@fb.com>
35 Cc: linux-kselftest@vger.kernel.org
36 Cc: linux-kernel@vger.kernel.org
37 Reviewed-by: Roman Gushchin <guro@fb.com>
38 Acked-by: Tejun Heo <tj@kernel.org>
39 Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
40 Signed-off-by: Sasha Levin <sashal@kernel.org>
41 ---
42 tools/testing/selftests/cgroup/test_memcontrol.c | 4 ++++
43 1 file changed, 4 insertions(+)
44
45 diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c
46 index 6f339882a6ca..c19a97dd02d4 100644
47 --- a/tools/testing/selftests/cgroup/test_memcontrol.c
48 +++ b/tools/testing/selftests/cgroup/test_memcontrol.c
49 @@ -1205,6 +1205,10 @@ int main(int argc, char **argv)
50 if (cg_read_strstr(root, "cgroup.controllers", "memory"))
51 ksft_exit_skip("memory controller isn't available\n");
52
53 + if (cg_read_strstr(root, "cgroup.subtree_control", "memory"))
54 + if (cg_write(root, "cgroup.subtree_control", "+memory"))
55 + ksft_exit_skip("Failed to set memory controller\n");
56 +
57 for (i = 0; i < ARRAY_SIZE(tests); i++) {
58 switch (tests[i].fn(root)) {
59 case KSFT_PASS:
60 --
61 2.20.1
62