From patchwork Fri Apr 15 00:01:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12814155 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57516C433F5 for ; Fri, 15 Apr 2022 00:01:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3FE76B0073; Thu, 14 Apr 2022 20:01:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC4886B0074; Thu, 14 Apr 2022 20:01:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB3E96B0075; Thu, 14 Apr 2022 20:01:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id BD0DD6B0073 for ; Thu, 14 Apr 2022 20:01:49 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8B15F3C6B for ; Fri, 15 Apr 2022 00:01:49 +0000 (UTC) X-FDA: 79357159938.17.9469607 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf22.hostedemail.com (Postfix) with ESMTP id EEC00C0004 for ; Fri, 15 Apr 2022 00:01:48 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649980907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MZnIyq/OEljf6qm4HzfEVtb31rpdSn51/YIxJ3qfZZM=; b=bIzP37NkG83HH+S+rk32b2S5PJLnI9dPJqbYcDHgEcjvMonvDewhyTg/y18EF7KlnsTvHe n+i3dkuRjygldl6S0SzyhD6r2oEbTxFu9ZgDc76aJtAWDSF3CJhxyY3SQlbyyRmwOslbb3 OYltxaTYQIm8+HHiOOF5NIiuCUk/aJE= From: Roman Gushchin To: Andrew Morton Cc: Tejun Heo , David Vernet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Roman Gushchin , Chris Down Subject: [PATCH 1/4] kselftests: memcg: update the oom group leaf events test Date: Thu, 14 Apr 2022 17:01:30 -0700 Message-Id: <20220415000133.3955987-2-roman.gushchin@linux.dev> In-Reply-To: <20220415000133.3955987-1-roman.gushchin@linux.dev> References: <20220415000133.3955987-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Stat-Signature: f7z75fsyenw6cwexy97k8hjzo6ysw6xo X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=bIzP37Nk; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf22.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: EEC00C0004 X-HE-Tag: 1649980908-319232 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 9852ae3fe529 ("mm, memcg: consider subtrees in memory.events") made memory.events recursive: all events are propagated upwards by the tree. It was a change in semantics. It broke the oom group leaf events test: it assumes that after an OOM the oom_kill counter is zero on parent's level. Let's adjust the test: it should have similar expectations for the child and parent levels. The test passes after this fix. Signed-off-by: Roman Gushchin Cc: Chris Down Cc: Johannes Weiner Reviewed-by: David Vernet --- tools/testing/selftests/cgroup/test_memcontrol.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 36ccf2322e21..00b430e7f2a2 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -1079,7 +1079,8 @@ static int test_memcg_sock(const char *root) /* * This test disables swapping and tries to allocate anonymous memory * up to OOM with memory.group.oom set. Then it checks that all - * processes in the leaf (but not the parent) were killed. + * processes in the leaf were killed. It also checks that oom_events + * were propagated to the parent level. */ static int test_memcg_oom_group_leaf_events(const char *root) { @@ -1122,7 +1123,7 @@ 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) + if (cg_read_key_long(parent, "memory.events", "oom_kill ") <= 0) goto cleanup; ret = KSFT_PASS; From patchwork Fri Apr 15 00:01:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12814156 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02007C433EF for ; Fri, 15 Apr 2022 00:01:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58A576B0074; Thu, 14 Apr 2022 20:01:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 539196B0075; Thu, 14 Apr 2022 20:01:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 401A36B0078; Thu, 14 Apr 2022 20:01:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 31DFF6B0074 for ; Thu, 14 Apr 2022 20:01:53 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 050ED1236B3 for ; Fri, 15 Apr 2022 00:01:52 +0000 (UTC) X-FDA: 79357160064.23.063DA2A Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf29.hostedemail.com (Postfix) with ESMTP id 60FDA120006 for ; Fri, 15 Apr 2022 00:01:52 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649980911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ka6qQQskUc/bYspKrrZopLIlbaTgRjrO9/vj2k3mAsU=; b=wp05x2nDGuHhLPy+P4GdOWff81+K1abp8o5tuqik6xqDvkyZ/oSb8zPKoJdbJXS0z26MwT P8Kj2Z2Ek+0hQqQeoTDsZjIeeOR1YxkTgZRXdeu3c4v4QGRVFLSqd6ohvg8jDYxZ+1lpKV dcMTGqq4kL0n/Bxm/VAcnLYnUTbCP/c= From: Roman Gushchin To: Andrew Morton Cc: Tejun Heo , David Vernet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Roman Gushchin , Chris Down Subject: [PATCH 2/4] kselftests: memcg: speed up the memory.high test Date: Thu, 14 Apr 2022 17:01:31 -0700 Message-Id: <20220415000133.3955987-3-roman.gushchin@linux.dev> In-Reply-To: <20220415000133.3955987-1-roman.gushchin@linux.dev> References: <20220415000133.3955987-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspam-User: X-Rspamd-Queue-Id: 60FDA120006 X-Stat-Signature: m9pup47nbeboi8ahw93xsizazsgdjm7j Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=wp05x2nD; spf=pass (imf29.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspamd-Server: rspam01 X-HE-Tag: 1649980912-878306 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: After commit 0e4b01df8659 ("mm, memcg: throttle allocators when failing reclaim over memory.high") allocating memory over memory.high became very time consuming. But it's exactly what the memory.high test from cgroup kselftests is doing: it tries to allocate 100M with 30M memory.high value. It takes forever to complete. In order to keep it passing (or failing) in a reasonable amount of time let's try to allocate only a little over 30M: 31M to be precise. With this change test_memcontrol finishes in a reasonable amount of time: $ time ./test_memcontrol ok 1 test_memcg_subtree_control ok 2 test_memcg_current ok 3 test_memcg_min ok 4 test_memcg_low ok 5 test_memcg_high ok 6 test_memcg_max ok 7 test_memcg_oom_events ok 8 test_memcg_swap_max ok 9 test_memcg_sock ok 10 test_memcg_oom_group_leaf_events ok 11 test_memcg_oom_group_parent_events ok 12 test_memcg_oom_group_score_events real 0m2.273s user 0m0.064s sys 0m0.739s Signed-off-by: Roman Gushchin Cc: Chris Down Cc: Johannes Weiner Reviewed-by: David Vernet --- tools/testing/selftests/cgroup/test_memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 00b430e7f2a2..9c1f19fe2e37 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -607,7 +607,7 @@ static int test_memcg_high(const char *root) if (cg_write(memcg, "memory.high", "30M")) goto cleanup; - if (cg_run(memcg, alloc_anon, (void *)MB(100))) + if (cg_run(memcg, alloc_anon, (void *)MB(31))) goto cleanup; if (!cg_run(memcg, alloc_pagecache_50M_check, NULL)) From patchwork Fri Apr 15 00:01:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12814157 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD5C1C433FE for ; Fri, 15 Apr 2022 00:01:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 478EE6B0075; Thu, 14 Apr 2022 20:01:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 429716B0078; Thu, 14 Apr 2022 20:01:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3173B6B007B; Thu, 14 Apr 2022 20:01:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 2506C6B0075 for ; Thu, 14 Apr 2022 20:01:56 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0348527E34 for ; Fri, 15 Apr 2022 00:01:55 +0000 (UTC) X-FDA: 79357160190.21.A3B3EB7 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf05.hostedemail.com (Postfix) with ESMTP id 6DDA010000B for ; Fri, 15 Apr 2022 00:01:55 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649980914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hmYLxb1+mMr6jmOwnIg2k48EEFJdR9ToYiqAQACrt3M=; b=nfzHyoF3QlG0i3ONCxWOVkP22GqWy34FQSUolZw34J6jzLgX3HnZJW//B8a7oIXF18S5Lj 6q+QBKlYxNFwuJhjmv06yLBxj6h0wbsU2Q7lC7w3ogchvkCNC4Pfke1EFRxtDGdTwuCZh+ 8BDA/ZA6jVpPFrWjLd2z1e5nwQ6yOdw= From: Roman Gushchin To: Andrew Morton Cc: Tejun Heo , David Vernet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Roman Gushchin , Zefan Li Subject: [PATCH 3/4] MAINTAINERS: add corresponding kselftests to cgroup entry Date: Thu, 14 Apr 2022 17:01:32 -0700 Message-Id: <20220415000133.3955987-4-roman.gushchin@linux.dev> In-Reply-To: <20220415000133.3955987-1-roman.gushchin@linux.dev> References: <20220415000133.3955987-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Stat-Signature: 1yrap1xg1i1qzc3uw95hufwri6m83pbq X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=nfzHyoF3; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf05.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 6DDA010000B X-HE-Tag: 1649980915-334234 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List cgroup kselftests in the cgroup MAINTAINERS entry. These are tests covering core, freezer and cgroup.kill functionality. Signed-off-by: Roman Gushchin Cc: Tejun Heo Cc: Zefan Li Cc: Johannes Weiner Cc: cgroups@vger.kernel.org Acked-by: Tejun Heo --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index d5731c03a485..44dabe0145ae 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4996,6 +4996,7 @@ F: Documentation/admin-guide/cgroup-v1/ F: Documentation/admin-guide/cgroup-v2.rst F: include/linux/cgroup* F: kernel/cgroup/ +F: tools/testing/selftests/cgroup/ CONTROL GROUP - BLOCK IO CONTROLLER (BLKIO) M: Tejun Heo From patchwork Fri Apr 15 00:01:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Gushchin X-Patchwork-Id: 12814158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F1CFC433EF for ; Fri, 15 Apr 2022 00:01:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33FC56B0078; Thu, 14 Apr 2022 20:01:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F1796B007B; Thu, 14 Apr 2022 20:01:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B85B6B007D; Thu, 14 Apr 2022 20:01:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 096376B0078 for ; Thu, 14 Apr 2022 20:01:59 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D348A23AC9 for ; Fri, 15 Apr 2022 00:01:58 +0000 (UTC) X-FDA: 79357160316.04.B7511E0 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf24.hostedemail.com (Postfix) with ESMTP id 3F75C180002 for ; Fri, 15 Apr 2022 00:01:58 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649980917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=740eiMaj1mMtgTIenrEzjJ/eAUZj68u7jwk/iuSKMgA=; b=w26K1SB+vI3qaqMdu0othXCQB1y7ABS7GYKBiHyjn7Oq83TXcDjd1nQYCaEtHy+xgPM2wp GsIYAeRN7r6m+9/Z7v8uqQDhugTRg+GPlcAUuoul5FPpn8AI9RG3IKCDqQzkdbFVSf5Awd sdlg8ExeisaxNfQ/UzhP7myUs0ox6Pc= From: Roman Gushchin To: Andrew Morton Cc: Tejun Heo , David Vernet , linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Roman Gushchin Subject: [PATCH 4/4] MAINTAINERS: add corresponding kselftests to memcg entry Date: Thu, 14 Apr 2022 17:01:33 -0700 Message-Id: <20220415000133.3955987-5-roman.gushchin@linux.dev> In-Reply-To: <20220415000133.3955987-1-roman.gushchin@linux.dev> References: <20220415000133.3955987-1-roman.gushchin@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3F75C180002 X-Stat-Signature: 3tgec4nke1odykjjonffyxb5cxrgn413 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=w26K1SB+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-HE-Tag: 1649980918-644369 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List memory control and kernel memory control kselftests in the memory resource controller entry. Signed-off-by: Roman Gushchin Cc: Johannes Weiner Cc: Michal Hocko Cc: Shakeel Butt Cc: cgroups@vger.kernel.org Cc: linux-mm@kvack.org --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 44dabe0145ae..0dd3d276f330 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5030,6 +5030,8 @@ L: linux-mm@kvack.org S: Maintained F: mm/memcontrol.c F: mm/swap_cgroup.c +F: tools/testing/selftests/cgroup/test_kmem.c +F: tools/testing/selftests/cgroup/test_memcontrol.c CORETEMP HARDWARE MONITORING DRIVER M: Fenghua Yu