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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 77544C54FD0 for ; Mon, 27 Apr 2020 17:05:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 317762076A for ; Mon, 27 Apr 2020 17:05:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="0DPrs31S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 317762076A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BDA278E0005; Mon, 27 Apr 2020 13:05:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B8A428E0001; Mon, 27 Apr 2020 13:05:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A78D38E0005; Mon, 27 Apr 2020 13:05:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 8FB828E0001 for ; Mon, 27 Apr 2020 13:05:52 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3C9D95DD7 for ; Mon, 27 Apr 2020 17:05:52 +0000 (UTC) X-FDA: 76754262144.02.verse91_16140af0c0102 X-HE-Tag: verse91_16140af0c0102 X-Filterd-Recvd-Size: 4433 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Mon, 27 Apr 2020 17:05:51 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id g74so18696590qke.13 for ; Mon, 27 Apr 2020 10:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ydL7u/iKiddCFVkRrBBVjKE0NSJjV6bxCTavWl6m0wQ=; b=0DPrs31SWPB1NzuRRT18QUS6XbTlWGqPQjnzKofQp3lCOXEcU5s91kNzKfQ5jbDWWU O00cWAOL0eAQ1qPKsYjcqX8JY7Q2JC8WjBbVBMr1wjVwu/OJ/+mumSxBVUYQm21lyzt6 vSP2yRnqaGDU+iOGywmf/XkNJxLy7yZJjLR9VC6lZtSYoK6nJnSgFdfOlUZssmdGoNnc 68ee6mY4AY1+uq+05zM7wVuj9XLQU3jK61PBZEJFVHgkan6tDWla2cHiI/BjoMajrbJQ 922kxHponcKFWrfhRLyEFvJ57CyEqXaifSrEWNKQ3B0Fr9/iEp2SfOu59qC+/hQlioLx ISCQ== 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=ydL7u/iKiddCFVkRrBBVjKE0NSJjV6bxCTavWl6m0wQ=; b=rFhqqeEyXNefzJ43w8nSPk6XifyBH5Z7FPLdX2PYqvhKd+gSjfeGvWivQH1Y1qd24A jF+eJg0fXJfhJKpUVIUka9seO1V7W08eObenX+qhNvIr83XOTlRDJQEhhZy0SGFX8qLk WkX7cXDNzUeaaYQ7waO0pZAHSrZ/N/um7QENUCiSasXjnOvW6N1z8wylfPhx4LOTNTr4 UU3TOcHcNsOdxrgtP2/v5/ASOckuxupCsmZHO7YpQJ+t6SxCm7gCbwDZqkMJIjvph01Z 8xx22Zsvdw1smGPOvn+CRAVDo6XlerqjVGrnif12gPr0me3U14j/W83pyhsaaZzPx0dn yHGA== X-Gm-Message-State: AGi0PuYT8Kf+7ZV8sChrqmSw7/jlP52rqDyGarvaHIGnF1SFqvRR1T+x dEgvSqrCNbqdp4rkNioRiwkB52mHsTc= X-Google-Smtp-Source: APiQypL96If5vWb47fEpMzWWSRC9x5O8s7ErydjFp2QI80e1hpijMklFnSoYL+fvCoPbDPMovLMdVQ== X-Received: by 2002:a37:7002:: with SMTP id l2mr23157836qkc.372.1588007150840; Mon, 27 Apr 2020 10:05:50 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id q15sm10779268qkn.100.2020.04.27.10.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 10:05:50 -0700 (PDT) Date: Mon, 27 Apr 2020 13:05:40 -0400 From: Johannes Weiner To: Yafang Shao Cc: akpm@linux-foundation.org, mhocko@kernel.org, guro@fb.com, chris@chrisdown.name, linux-mm@kvack.org Subject: Re: [PATCH 0/3] mm: improve proportional memcg protection Message-ID: <20200427170540.GB29022@cmpxchg.org> References: <20200425152418.28388-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200425152418.28388-1-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, Apr 25, 2020 at 11:24:15AM -0400, Yafang Shao wrote: > Since proportional memory.{min, low} reclaim is introduced in > commit 9783aa9917f8 ("mm, memcg: proportional memory.{low,min} reclaim"), > it have been proved that the proportional reclaim is hard to understand and > the issues caused by it is harder to understand.[1]. That dilemma faced by > us is caused by that the proportional reclaim mixed up memcg and the > reclaim context. > > In proportional reclaim, the whole reclaim context - includes the memcg > to be reclaimed and the reclaimer, should be considered, rather than > memcg only. > > To make it clear, a new member 'protection' is introduced in the reclaim > context (struct shrink_control) to replace mem_cgroup_protection(). This > one is set when we check whether the memcg is protected or not. This patch series makes the code harder to understand. It's already tricky to understand ownership and lifetime/validity of struct scan_control members when it's just vmscan.c functions touching them. Expanding the scope to the entire MM is a bad idea. Splitting up sc->memcg_low_reclaim handling and the associated restart logic makes control flow harder to follow as well. The problem with the current code is a suboptimal interface between the memcg protection calculation and the reclaim control flow. We need to clean that up, not remove the interface and thereby all clarity on who handles which information.