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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D83C5C3A5A9 for ; Mon, 4 May 2020 07:52:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9EFB320746 for ; Mon, 4 May 2020 07:52:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EFB320746 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 351F48E0006; Mon, 4 May 2020 03:52:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3026A8E0001; Mon, 4 May 2020 03:52:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 218548E0006; Mon, 4 May 2020 03:52:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 07B5B8E0001 for ; Mon, 4 May 2020 03:52:45 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B125B180AD811 for ; Mon, 4 May 2020 07:52:44 +0000 (UTC) X-FDA: 76778269848.20.table36_6f3a122f04020 X-HE-Tag: table36_6f3a122f04020 X-Filterd-Recvd-Size: 4411 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 07:52:44 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id h9so9374102wrt.0 for ; Mon, 04 May 2020 00:52:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5AwUqmr1qe1lmiLdrlabJTQ2s1RmkwXP4w/ybOhlBC0=; b=R1e1TI+Iaq0oyHCBUke3F8X7X5QYgr+ttJjXol7LAtNexomqX+tWmuSWsGTJQdZ1sF /iS/2lkZpgOcDkxqtTdIf9mKqgdnfQ2bUbOOVV0oUB8xVhsnsOQRIKwQrHD/ISgMSW5+ mI385X/CY1eCcM/ehUQz+UHUhprGqXxvkkog1xsefBE/ASupwe8i/JG9ac3+dChCyIb4 p/ryc90pZcL0hkSNyNKkNIh+CH+HWUgCLfu+i9Dm7YGXxys0Q0iX4JihxPYeDkFCNSE9 NVrGjQQmCqFSsWi4CaNOAQM1E65bb+36lX6fm9EGF5JFds2KrjNde4UvB2h8QjsGXU9i dj4w== X-Gm-Message-State: AGi0Pua/XJ6h4uV4znB5ZMMPHRB2Wy9slxZ/BGEqF5s/InUbF+y3xRnB uKwI4cV5VC/s5sgsaMnMu+pD54QN X-Google-Smtp-Source: APiQypJdd589eYNObcYyupcdMe/Hk47Y4a/a26RFeJ/U3qjYKRnYiMhgDBFi6IsUABU1vOziwfveuQ== X-Received: by 2002:a5d:4109:: with SMTP id l9mr17694434wrp.300.1588578763223; Mon, 04 May 2020 00:52:43 -0700 (PDT) Received: from localhost (ip-37-188-183-9.eurotel.cz. [37.188.183.9]) by smtp.gmail.com with ESMTPSA id d143sm12110536wmd.16.2020.05.04.00.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 00:52:42 -0700 (PDT) Date: Mon, 4 May 2020 09:52:40 +0200 From: Michal Hocko To: Yafang Shao Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, chris@chrisdown.name, guro@fb.com, linux-mm@kvack.org Subject: Re: [PATCH v2 1/2] mm, memcg: Avoid stale protection values when cgroup is above protection Message-ID: <20200504075240.GF22838@dhcp22.suse.cz> References: <20200502135910.7255-1-laoar.shao@gmail.com> <20200502135910.7255-2-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200502135910.7255-2-laoar.shao@gmail.com> 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 Sat 02-05-20 09:59:09, Yafang Shao wrote: > A cgroup can have both memory protection and a memory limit to isolate > it from its siblings in both directions - for example, to prevent it > from being shrunk below 2G under high pressure from outside, but also > from growing beyond 4G under low pressure. > > Commit 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim") > implemented proportional scan pressure so that multiple siblings in > excess of their protection settings don't get reclaimed equally but > instead in accordance to their unprotected portion. > > During limit reclaim, this proportionality shouldn't apply of course: > there is no competition, all pressure is from within the cgroup and > should be applied as such. Reclaim should operate at full efficiency. > > However, mem_cgroup_protected() never expected anybody to look at the > effective protection values when it indicated that the cgroup is above > its protection. As a result, a query during limit reclaim may return > stale protection values that were calculated by a previous reclaim cycle > in which the cgroup did have siblings. > > When this happens, reclaim is unnecessarily hesitant and potentially > slow to meet the desired limit. In theory this could lead to premature > OOM kills, although it's not obvious this has occurred in practice. > > [hannes@cmpxchg.org: changelog] > [mhocko@kernel.org: rework code comment] > [chris@chrisdown.name: retitle] > Fixes: 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim") > Signed-off-by: Yafang Shao > Acked-by: Roman Gushchin > Cc: Michal Hocko > Cc: Johannes Weiner > Cc: Chris Down I have only now processed my inbox to this email. Please consider the changelog part which explains the fix I have posted earlier this morning http://lkml.kernel.org/r/20200504072342.GD22838@dhcp22.suse.cz Other than that Acked-by: Michal Hocko -- Michal Hocko SUSE Labs