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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 2A9EFC3B188 for ; Thu, 13 Feb 2020 01:48:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC53220873 for ; Thu, 13 Feb 2020 01:48:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ss6Lnwur" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC53220873 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 253F46B04F2; Wed, 12 Feb 2020 20:48:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 203E46B04F3; Wed, 12 Feb 2020 20:48:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11ABA6B04F4; Wed, 12 Feb 2020 20:48:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id EB46D6B04F2 for ; Wed, 12 Feb 2020 20:48:06 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B014F180AD804 for ; Thu, 13 Feb 2020 01:48:06 +0000 (UTC) X-FDA: 76483418172.29.swim87_46c77e032580b X-HE-Tag: swim87_46c77e032580b X-Filterd-Recvd-Size: 5771 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Feb 2020 01:48:06 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id z1so4042785iom.9 for ; Wed, 12 Feb 2020 17:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NcupujMoNZ+lhM7+9GoPlR+Ij7mhzM+rhSEsy6lC7Ik=; b=Ss6Lnwurj/uXI0dVZEJyGvlmTQz36Vl5AU9orRG34T+RQ/yrm8Sa/Pyjqc03UKVRiZ NwZsF052DjppBJaKpAY2JiyDZWKz1nKX0olUFwP2ddsxBW+iK0U4vTunmy1rxO7c6v1B qRzLV/Rlct/AbvpVx4BhaSqsOmcy9UhqRwQqtID7p5gaKk9qHQfASNQYzuLCn8RZrvW9 lBUkoPPdBwahHCL3uIYZW4EeIxT62fsE4iFR5R8gbjhT028SJFzGLdoXuHFdRMfJofuD tdS/o6Y37PwBdAOXm1ZfnXxwL0inuKGDQoIpET6WWcooE0xDu9SaHh3BSzP9B/PN/+Ab 0zIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NcupujMoNZ+lhM7+9GoPlR+Ij7mhzM+rhSEsy6lC7Ik=; b=AlR8DASDv1LUtwj5h1wIlL+PypJxxA6O5cobr/1JSsVI+T8yhCaFHMcj4b/1bKB35j sz8LWacBxjsGItalfrE7kqdwfxK9KS++dALovxQBzUEwRlKjok88Ocv4EH5MJhfozfb5 7l/5TcCPQHHU7/9aBFYkOe7x5JEw3zHQBd2L/dEB8RIXUXe6OXInFoP4tQoDCrTAxGvj yrAO5mpZxKvYW8k/57brBQoq263Or7eIneP624o1VoYxzU6mkCx4Sm/PAqtaAjmy0x2Y iskb/sZMx1C451Ykhvgjz75l9TMaQQ3xIh/EHJjL9dkUqoCy/lPQQFQFXdT0QUKV/GHP J7bQ== X-Gm-Message-State: APjAAAXK1pwTRuvXfLW3HHyQtz6s96zcPyDoh6uLp2G8bklGw9vku16N KolNGHfuqUCwK0QTrD4k01F6bgJ7y6iujlEtkpY= X-Google-Smtp-Source: APXvYqxb42gp94oWdM1n869TeR04MYPvf28xXFK13g9YzcEdKofl2Cxbd8zU9kffQASjNIdmEHHyaF4qdiijGBOLbuk= X-Received: by 2002:a5d:8146:: with SMTP id f6mr19522873ioo.93.1581558485520; Wed, 12 Feb 2020 17:48:05 -0800 (PST) MIME-Version: 1.0 References: <20200211175507.178100-1-hannes@cmpxchg.org> <20200212164235.GB180867@cmpxchg.org> In-Reply-To: <20200212164235.GB180867@cmpxchg.org> From: Yafang Shao Date: Thu, 13 Feb 2020 09:47:29 +0800 Message-ID: Subject: Re: [PATCH] vfs: keep inodes with page cache off the inode shrinker LRU To: Johannes Weiner Cc: linux-fsdevel@vger.kernel.org, Linux MM , LKML , Dave Chinner , Michal Hocko , Roman Gushchin , Andrew Morton , Linus Torvalds , Al Viro , Kernel Team Content-Type: text/plain; charset="UTF-8" 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 Thu, Feb 13, 2020 at 12:42 AM Johannes Weiner wrote: > > On Wed, Feb 12, 2020 at 08:25:45PM +0800, Yafang Shao wrote: > > On Wed, Feb 12, 2020 at 1:55 AM Johannes Weiner wrote: > > > Another variant of this problem was recently observed, where the > > > kernel violates cgroups' memory.low protection settings and reclaims > > > page cache way beyond the configured thresholds. It was followed by a > > > proposal of a modified form of the reverted commit above, that > > > implements memory.low-sensitive shrinker skipping over populated > > > inodes on the LRU [1]. However, this proposal continues to run the > > > risk of attracting disproportionate reclaim pressure to a pool of > > > still-used inodes, > > > > Hi Johannes, > > > > If you really think that is a risk, what about bellow additional patch > > to fix this risk ? > > > > diff --git a/fs/inode.c b/fs/inode.c > > index 80dddbc..61862d9 100644 > > --- a/fs/inode.c > > +++ b/fs/inode.c > > @@ -760,7 +760,7 @@ static bool memcg_can_reclaim_inode(struct inode *inode, > > goto out; > > > > cgroup_size = mem_cgroup_size(memcg); > > - if (inode->i_data.nrpages + protection >= cgroup_size) > > + if (inode->i_data.nrpages) > > reclaimable = false; > > > > out: > > > > With this additional patch, we skip all inodes in this memcg until all > > its page cache pages are reclaimed. > > Well that's something we've tried and had to revert because it caused > issues in slab reclaim. See the History part of my changelog. > You misuderstood it. The reverted patch skips all inodes in the system, while this patch only works when you turn on memcg.{min, low} protection. IOW, that is not a default behavior, while it only works when you want it and only effect your targeted memcg rather than the whole system. > > > while not addressing the more generic reclaim > > > inversion problem outside of a very specific cgroup application. > > > > > > > But I have a different understanding. This method works like a > > knob. If you really care about your workingset (data), you should > > turn it on (i.e. by using memcg protection to protect them), while > > if you don't care about your workingset (data) then you'd better > > turn it off. That would be more flexible. Regaring your case in the > > commit log, why not protect your linux git tree with memcg > > protection ? > > I can't imagine a scenario where I *wouldn't* care about my > workingset, though. Why should it be opt-in, not the default? Because the default behavior has caused the XFS performace hit. (I haven't checked your patch carefully, so I don't know whehter your patch fix it yet.) Thanks Yafang