From nobody Mon May 11 04:11:23 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 832BAC433EF for ; Fri, 15 Apr 2022 00:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347838AbiDOAEU (ORCPT ); Thu, 14 Apr 2022 20:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347815AbiDOAEP (ORCPT ); Thu, 14 Apr 2022 20:04:15 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48EEB6350F; Thu, 14 Apr 2022 17:01:49 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/testi= ng/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 cha= r *root) if (cg_read_key_long(child, "memory.events", "oom_kill ") <=3D 0) goto cleanup; =20 - if (cg_read_key_long(parent, "memory.events", "oom_kill ") !=3D 0) + if (cg_read_key_long(parent, "memory.events", "oom_kill ") <=3D 0) goto cleanup; =20 ret =3D KSFT_PASS; --=20 2.35.1 From nobody Mon May 11 04:11:23 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD4AC433F5 for ; Fri, 15 Apr 2022 00:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347847AbiDOAEX (ORCPT ); Thu, 14 Apr 2022 20:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347822AbiDOAET (ORCPT ); Thu, 14 Apr 2022 20:04:19 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94DF16350F; Thu, 14 Apr 2022 17:01:52 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/testi= ng/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; =20 - if (cg_run(memcg, alloc_anon, (void *)MB(100))) + if (cg_run(memcg, alloc_anon, (void *)MB(31))) goto cleanup; =20 if (!cg_run(memcg, alloc_pagecache_50M_check, NULL)) --=20 2.35.1 From nobody Mon May 11 04:11:23 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ADA9C433F5 for ; Fri, 15 Apr 2022 00:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347879AbiDOAE3 (ORCPT ); Thu, 14 Apr 2022 20:04:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347839AbiDOAEW (ORCPT ); Thu, 14 Apr 2022 20:04:22 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD8A6350F; Thu, 14 Apr 2022 17:01:55 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/ =20 CONTROL GROUP - BLOCK IO CONTROLLER (BLKIO) M: Tejun Heo --=20 2.35.1 From nobody Mon May 11 04:11:23 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E57CFC433EF for ; Fri, 15 Apr 2022 00:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347874AbiDOAEe (ORCPT ); Thu, 14 Apr 2022 20:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347856AbiDOAEZ (ORCPT ); Thu, 14 Apr 2022 20:04:25 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 927E885962; Thu, 14 Apr 2022 17:01:58 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =20 CORETEMP HARDWARE MONITORING DRIVER M: Fenghua Yu --=20 2.35.1