From: "Michal Koutný" <mkoutny@suse.com> To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeelb@google.com>, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Richard Palethorpe <rpalethorpe@suse.de> Subject: [PATCH 1/4] selftests: memcg: Fix compilation Date: Wed, 18 May 2022 17:40:34 +0200 [thread overview] Message-ID: <20220518154037.18819-2-mkoutny@suse.com> (raw) In-Reply-To: <20220518154037.18819-1-mkoutny@suse.com> This fixes mis-applied changes from commit 72b1e03aa725 ("cgroup: account for memory_localevents in test_memcg_oom_group_leaf_events()"). Signed-off-by: Michal Koutný <mkoutny@suse.com> --- .../selftests/cgroup/test_memcontrol.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 6ab94317c87b..4958b42201a9 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -1241,7 +1241,16 @@ static int test_memcg_oom_group_leaf_events(const char *root) if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) goto cleanup; - if (cg_read_key_long(parent, "memory.events", "oom_kill ") <= 0) + parent_oom_events = cg_read_key_long( + parent, "memory.events", "oom_kill "); + /* + * If memory_localevents is not enabled (the default), the parent should + * count OOM events in its children groups. Otherwise, it should not + * have observed any events. + */ + if (has_localevents && parent_oom_events != 0) + goto cleanup; + else if (!has_localevents && parent_oom_events <= 0) goto cleanup; ret = KSFT_PASS; @@ -1349,20 +1358,14 @@ static int test_memcg_oom_group_score_events(const char *root) if (!cg_run(memcg, alloc_anon, (void *)MB(100))) goto cleanup; - parent_oom_events = cg_read_key_long( - parent, "memory.events", "oom_kill "); - /* - * If memory_localevents is not enabled (the default), the parent should - * count OOM events in its children groups. Otherwise, it should not - * have observed any events. - */ - if ((has_localevents && parent_oom_events == 0) || - parent_oom_events > 0) - ret = KSFT_PASS; + if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) + FAIL(cleanup); if (kill(safe_pid, SIGKILL)) goto cleanup; + ret = KSFT_PASS; + cleanup: if (memcg) cg_destroy(memcg); -- 2.35.3
WARNING: multiple messages have this Message-ID (diff)
From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org> To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>, Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>, Roman Gushchin <roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>, Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Richard Palethorpe <rpalethorpe-l3A5Bk7waGM@public.gmane.org> Subject: [PATCH 1/4] selftests: memcg: Fix compilation Date: Wed, 18 May 2022 17:40:34 +0200 [thread overview] Message-ID: <20220518154037.18819-2-mkoutny@suse.com> (raw) In-Reply-To: <20220518154037.18819-1-mkoutny-IBi9RG/b67k@public.gmane.org> This fixes mis-applied changes from commit 72b1e03aa725 ("cgroup: account for memory_localevents in test_memcg_oom_group_leaf_events()"). Signed-off-by: Michal Koutn√Ω <mkoutny-IBi9RG/b67k@public.gmane.org> --- .../selftests/cgroup/test_memcontrol.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 6ab94317c87b..4958b42201a9 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -1241,7 +1241,16 @@ static int test_memcg_oom_group_leaf_events(const char *root) if (cg_read_key_long(child, "memory.events", "oom_kill ") <= 0) goto cleanup; - if (cg_read_key_long(parent, "memory.events", "oom_kill ") <= 0) + parent_oom_events = cg_read_key_long( + parent, "memory.events", "oom_kill "); + /* + * If memory_localevents is not enabled (the default), the parent should + * count OOM events in its children groups. Otherwise, it should not + * have observed any events. + */ + if (has_localevents && parent_oom_events != 0) + goto cleanup; + else if (!has_localevents && parent_oom_events <= 0) goto cleanup; ret = KSFT_PASS; @@ -1349,20 +1358,14 @@ static int test_memcg_oom_group_score_events(const char *root) if (!cg_run(memcg, alloc_anon, (void *)MB(100))) goto cleanup; - parent_oom_events = cg_read_key_long( - parent, "memory.events", "oom_kill "); - /* - * If memory_localevents is not enabled (the default), the parent should - * count OOM events in its children groups. Otherwise, it should not - * have observed any events. - */ - if ((has_localevents && parent_oom_events == 0) || - parent_oom_events > 0) - ret = KSFT_PASS; + if (cg_read_key_long(memcg, "memory.events", "oom_kill ") != 3) + FAIL(cleanup); if (kill(safe_pid, SIGKILL)) goto cleanup; + ret = KSFT_PASS; + cleanup: if (memcg) cg_destroy(memcg); -- 2.35.3
next prev parent reply other threads:[~2022-05-18 15:41 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-18 15:40 [PATCH 0/4] memcontrol selftests fixups Michal Koutný 2022-05-18 15:40 ` Michal Koutný 2022-05-18 15:40 ` Michal Koutný [this message] 2022-05-18 15:40 ` [PATCH 1/4] selftests: memcg: Fix compilation Michal Koutný 2022-05-18 15:40 ` [PATCH 2/4] selftests: memcg: Expect no low events in unprotected sibling Michal Koutný 2022-05-18 15:40 ` Michal Koutný 2022-05-18 15:40 ` [PATCH 3/4] selftests: memcg: Adjust expected reclaim values of protected cgroups Michal Koutný 2022-05-18 15:40 ` Michal Koutný 2022-05-18 15:40 ` [PATCH 4/4] selftests: memcg: Remove protection from top level memcg Michal Koutný 2022-05-18 15:40 ` Michal Koutný 2022-05-18 16:27 ` [PATCH 0/4] memcontrol selftests fixups Michal Koutný 2022-05-18 16:27 ` Michal Koutný -- strict thread matches above, loose matches on Subject: below -- 2022-05-12 17:44 [PATCH v2 0/5] Fix bugs in memcontroller cgroup tests David Vernet 2022-05-13 17:18 ` [PATCH 0/4] memcontrol selftests fixups Michal Koutný 2022-05-13 17:18 ` [PATCH 1/4] selftests: memcg: Fix compilation Michal Koutný 2022-05-13 17:18 ` Michal Koutný 2022-05-13 17:40 ` David Vernet 2022-05-13 17:40 ` David Vernet 2022-05-13 18:53 ` Roman Gushchin 2022-05-13 18:53 ` Roman Gushchin 2022-05-13 19:09 ` Roman Gushchin 2022-05-13 19:09 ` Roman Gushchin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220518154037.18819-2-mkoutny@suse.com \ --to=mkoutny@suse.com \ --cc=cgroups@vger.kernel.org \ --cc=hannes@cmpxchg.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mhocko@kernel.org \ --cc=roman.gushchin@linux.dev \ --cc=rpalethorpe@suse.de \ --cc=shakeelb@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.