Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3819032ioo; Wed, 25 May 2022 08:45:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUF+7p4oIA53Z6WB8Q6nGpOpJN4OItg7uWsLkE0fc3MXFgDQEe69uTMgqNmgtX74Dpecfu X-Received: by 2002:a17:903:32cc:b0:161:9539:fd49 with SMTP id i12-20020a17090332cc00b001619539fd49mr33973010plr.117.1653493552822; Wed, 25 May 2022 08:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653493552; cv=none; d=google.com; s=arc-20160816; b=EHeDE9z8jeiCNEC+DO04DUjdq0ytAzRUXd2orwjEftUtQJaMSoPzj+6FZ95fWhOmLo QGrbnkKt/jlZnU+V92QfiPa0kLiC7V5z3ynX9xMCFCv4BWj0EiYTFm8GajapexUNDQ00 emj1d872/4ozbdKHVf7qeqvjVUadXivEq31MS5WIns7RtWq1YHQybAamrdE8cwdLx8gp uN3vOSanIfMIYxUu+fyR3zAO4RB6zIEkDWzjQNILxRGgN8qgGjp1TqykFm+VBrGPzn27 6EAchPUNkZTuKS02WtLgcY6xbDlqvIjQjBptPJp4LqJXIG6g6pbGAuOJIw5YulpDZKU8 KefQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TImBZ6/Xs1On34ZPG5L5wJ0F84vjqxu5LZFuNx3+3N8=; b=YTz7uUPuQeTk1ePAzeqmNy5n+JDxpLrgtu6JQ2fbC9RUKO4GeBMPj6+K+b2N9BTBAU +eLNKuHBpHmo7cDamKhEZSVNaJOYowA9u0TBeUpp9svc33JYMazG8KK0h1sIRJ0PPEdx A3/In9iWnhCKYbOaGpoGmKGlQNCXLLzMHcbj9RQRMpjbeKm7ztlIMolgBvrxhKGR4E+I mOW3dCImlRybzGzQUIvWUEYkfKW2EDaEovxGQXv+ybJRbPqUWcyr0ZwR18tSetiWods/ 88aULGbtPaO1DJo4E12/oaj1N1YyaDgZ9MWCY3AP0UDFvVTq/458TpE9jGJnbDJBiQvd bWNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cUM6sQMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw28-20020a056a00451c00b0050ad0f19e40si23031891pfb.53.2022.05.25.08.45.38; Wed, 25 May 2022 08:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cUM6sQMi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239703AbiEXQaT (ORCPT + 99 others); Tue, 24 May 2022 12:30:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbiEXQaP (ORCPT ); Tue, 24 May 2022 12:30:15 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D7ED38D95; Tue, 24 May 2022 09:30:13 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C2F641F91F; Tue, 24 May 2022 16:30:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1653409811; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TImBZ6/Xs1On34ZPG5L5wJ0F84vjqxu5LZFuNx3+3N8=; b=cUM6sQMiAS+T+jJH5GaZ2WL/vRUwXMV9p+YMI81jj/gzuGjLJ8S7g1TRdZj9qNixexgu3h q038pKLE0F292Oi/zJ2oHPrzyInRtrERWYhsgRxN69D238g+7y1RzuiJr7HM29Dx7pBSyL p7adX906CxWWY1HTXLLnvf2vspCZoZs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8757613B1E; Tue, 24 May 2022 16:30:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6PT9HxMIjWJaWgAAMHmgww (envelope-from ); Tue, 24 May 2022 16:30:11 +0000 From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Richard Palethorpe , Muhammad Usama Anjum Subject: [PATCH v3 1/5] selftests: memcg: Fix compilation Date: Tue, 24 May 2022 18:29:51 +0200 Message-Id: <20220524162955.8635-2-mkoutny@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220524162955.8635-1-mkoutny@suse.com> References: <20220524162955.8635-1-mkoutny@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This fixes mis-applied changes from commit 72b1e03aa725 ("cgroup: account for memory_localevents in test_memcg_oom_group_leaf_events()"). Fixes: 72b1e03aa725 ("cgroup: account for memory_localevents in test_memcg_oom_group_leaf_events()") Signed-off-by: Michal Koutný Reviewed-by: David Vernet Acked-by: Roman Gushchin --- .../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..c012db9d07d6 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) + goto cleanup; if (kill(safe_pid, SIGKILL)) goto cleanup; + ret = KSFT_PASS; + cleanup: if (memcg) cg_destroy(memcg); -- 2.35.3