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;