Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2580812rwi; Tue, 11 Oct 2022 10:28:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7p9Zc8QuEb5JMNAs0+g/1rzsOylnqEFTutT9T8nQsWMJDdQNDUDE7S69yG2JrQz0TyoTdN X-Received: by 2002:a05:6402:3551:b0:45c:360:bfd5 with SMTP id f17-20020a056402355100b0045c0360bfd5mr12879126edd.136.1665509296710; Tue, 11 Oct 2022 10:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665509296; cv=none; d=google.com; s=arc-20160816; b=S87Se24pWcNAZ3o1h0pJ2GR2G2zH9f86oObIBjIudr944xGFqJN6hvNgdTzx2z5E0X UNxqPugIaoaFs6odD/xHOK5qOItYHTy6s1bABSJR8olTT3yurspKi1VCaDjvRRtt5KX0 vtUnHjkGGxZgneLQCmtfbh3Ki8LLBX9oNx1wCFB+Y9jAbrw6Yv5dDQ6Lb5LlL0S09maF p6Od0SSvT1OsvOKuKrhmSyxguTIpyVNGcQU+DG68KAY7AMK8nct8wZ+dH5zhaAbdlxDU zZ4z2PXTaU0HtXM69BSZWhXtIoiawsNSeyC5tm2UNap4dV24PUAhsU6KQYNm0QmzYDXX i27g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=+rCyzNiafV5vn9qzVyq2e5KcGK78bTJRE4XDDdx4VjI=; b=YzwgAtkh3IwGIb7kS9nZXIDe5oRN11l4IhfFj+mNNz89pTMGfAkXphiQDHGA+EjPO9 2T+3kq/5DMD6nYFHHUktMUlkGZdMeahYaAW5gI7MIfQrov+1oWAGbW5qAFsmuKbVjrWe /Honub0VSvFOFAuAJeX1qAKGjpD4WbZJ1Vk4AlH4azD+a2jyuk+oWUtslTmOHwRSWmOB TgDIpkuKOXIrK6ygVqdkRbX/94mWxvgzBl/tU5cyfObhDmiabqbtc4xf+QR7yzOxKHsI C+qpGPaY9LEJSeT25pfEIVx3FsBCdqih1xYdNBoClT4xIeLvKuB3l5k9F2bLhR6coEWL z2jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=D6E5zEoN; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a1709067cc200b0078d148daf4bsi11221533ejp.409.2022.10.11.10.27.50; Tue, 11 Oct 2022 10:28:16 -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=@redhat.com header.s=mimecast20190719 header.b=D6E5zEoN; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiJKRAd (ORCPT + 99 others); Tue, 11 Oct 2022 13:00:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbiJKRAc (ORCPT ); Tue, 11 Oct 2022 13:00:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E96F343AD2 for ; Tue, 11 Oct 2022 10:00:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665507629; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+rCyzNiafV5vn9qzVyq2e5KcGK78bTJRE4XDDdx4VjI=; b=D6E5zEoN2COIye4o0bHlVvTc6SUSwDmnq/zA4JD689nUCw1BNmFd5I/02xRXvRr8c3qX3V AQ1G8AuxwuHbeEA0h8QXPUshNkKE/+7TCasouLDZ4LSUVlApO+Q17wkWUlnTQNZ++omkrx Zf/Vs+2C8bd0TtQSTCkod3mpAFqX68o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-169-FnjlEY_zMwGOlULVLQmSFg-1; Tue, 11 Oct 2022 13:00:24 -0400 X-MC-Unique: FnjlEY_zMwGOlULVLQmSFg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 197AD801585; Tue, 11 Oct 2022 17:00:23 +0000 (UTC) Received: from [10.22.17.56] (unknown [10.22.17.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CD35414A809; Tue, 11 Oct 2022 17:00:22 +0000 (UTC) Message-ID: Date: Tue, 11 Oct 2022 13:00:22 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] mm/memcontrol: Don't increase effective low/min if no protection needed Content-Language: en-US To: Michal Hocko 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 References: <20221011143015.1152968-1-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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 On 10/11/22 11:39, Michal Hocko wrote: > 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? Yes, the memory_recursiveprot mount option is indeed turned on. > >> 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. You are right about that. An alternative way to address this issue is to disable memory low event when memory.low isn't set. An user who want to track memory.low event has to set it to a non-zero value. Would that be acceptable? Cheers, Longman