From mboxrd@z Thu Jan 1 00:00:00 1970 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 54537C433FE for ; Tue, 11 Oct 2022 15:39:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A8EBE6B0071; Tue, 11 Oct 2022 11:39:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3E946B0073; Tue, 11 Oct 2022 11:39:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DEE46B0074; Tue, 11 Oct 2022 11:39:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 78E0A6B0071 for ; Tue, 11 Oct 2022 11:39:44 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 29C6141310 for ; Tue, 11 Oct 2022 15:39:44 +0000 (UTC) X-FDA: 80009078688.01.E060AFE Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf21.hostedemail.com (Postfix) with ESMTP id 7F16B1C0021 for ; Tue, 11 Oct 2022 15:39:43 +0000 (UTC) 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 205E21F8E0; Tue, 11 Oct 2022 15:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1665502782; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vB0AXXBtm0Hrdk0bg6YG9HeCQbPU+AcCqyHQMZO7aHU=; b=AOyiExVT8ICluY29f7EISViuBP4fZfaDGjWt/zgw/wKFtAhm86QAWBAMm3OGNO88yDbw4L dCppJmVuT0D38ZQBGQ4D/GsypMU9r0HpZIlyL+USdsMoBBwX+vizkRdpijHy57HK/3+fS7 wQVsY/OckiDS1Src/EUzygFkKRStZJs= 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 E9FF813AAC; Tue, 11 Oct 2022 15:39:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6uS9Nj2ORWNyWwAAMHmgww (envelope-from ); Tue, 11 Oct 2022 15:39:41 +0000 Date: Tue, 11 Oct 2022 17:39:41 +0200 From: Michal Hocko To: Waiman Long Cc: Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Chris Down Subject: Re: [PATCH] mm/memcontrol: Don't increase effective low/min if no protection needed Message-ID: References: <20221011143015.1152968-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221011143015.1152968-1-longman@redhat.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665502783; a=rsa-sha256; cv=none; b=NpSkDKiNj275jRlHZ+oynbJU6gYSUXnn27ATLK0oem5q2gvKt8JvdQ7A4FQZEF+SN9bkys N0TV9Kjl4Onb6rfTmmb710nM6GnRLJKJMTdcVbAePpLpLT9pJv2txAy7nQXZAoskkZF+Wb ENpDtCj3+E+aBkvAdjYnJxCcbzR98kM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=AOyiExVT; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf21.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665502783; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vB0AXXBtm0Hrdk0bg6YG9HeCQbPU+AcCqyHQMZO7aHU=; b=6yWC25nPFhqCM3cBZvk1QNDTYknvOfvKX/w/qwYTHH/ehvJQEjgBJ/2BEXcLfeIjl2Dnla n6vbLCKtQhw4QgkZUQ45dqlgqVIKribA7rrVzcAihgEWEmWUFLKaG+OWNifg5Muagh7bhO bMZHKMI8I3xxnSpO1Pa7Y6Pi9V09EJ4= X-Stat-Signature: ewtgbz17g6b6mrn1kktu9ozkojfc8ity X-Rspamd-Queue-Id: 7F16B1C0021 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=AOyiExVT; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf21.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1665502783-721446 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: On Tue 11-10-22 10:30:15, Waiman Long wrote: > Since commit bc50bcc6e00b ("mm: memcontrol: clean up and document > effective low/min calculations"), the effective low/min protections can > be non-zero even if the corresponding memory.low/min values are 0. That > can surprise users to see MEMCG_LOW events even when the memory.low > value is not set. One example is the LTP's memcontrol04 test which fails > because it detects some MEMCG_LOW events for a cgroup with a memory.min > value of 0. Is this with memory_recursiveprot mount option? > Fix this by updating effective_protection() to not returning a non-zero > low/min protection values if the corresponding memory.low/min values > or those of its parent are 0. > > Fixes: bc50bcc6e00b ("mm: memcontrol: clean up and document effective low/min calculations") > Signed-off-by: Waiman Long > --- > mm/memcontrol.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index b69979c9ced5..893d4d5e518a 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -6660,6 +6660,9 @@ static unsigned long effective_protection(unsigned long usage, > unsigned long protected; > unsigned long ep; > > + if (!setting || !parent_effective) > + return 0UL; /* No protection is needed */ > + This will break the above memory_recursiveprot AFAICS. > protected = min(usage, setting); > /* > * If all cgroups at this level combined claim and use more > -- > 2.31.1 -- Michal Hocko SUSE Labs