Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6252008ybv; Wed, 12 Feb 2020 08:43:07 -0800 (PST) X-Google-Smtp-Source: APXvYqxTdGdfo7mbbtLxF4GDOyQIZDTWKC+3HRD/nsKv9GZMuYN9wGwfJGOHapIbsI40NT2UQ9rg X-Received: by 2002:a9d:6f0d:: with SMTP id n13mr10211175otq.165.1581525787214; Wed, 12 Feb 2020 08:43:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581525787; cv=none; d=google.com; s=arc-20160816; b=EQxyReAWTWpontl5h67D6+7JGJhB3B7Q8xigobPhlGB3D3mPPwmEMUmEF3Hc5pjsrf NERv4eGLe8ZlOZ6WSpFu05SZJeXcxXNwEx1JGk7MMC6MzxLnhPK9uJzP35Byz+4WCLbC GclE61nb81xykg4J8H0ug4uTTz4mqNt7LiUwzfSk7OvDAH3mw6Q6RFskCW8tjkP/DmAl XSf3zeGMDGhE8rbDgHM825UoxVApKjXDPJ41tM01SVykdKnb0jsLC20r1YshwCHjyMr1 DxEf50bXBCawY/9+J9RngZcb5dNcz/oA3whvr3GpN/rpI4IQpKD0oZ+cwGLk4hzrSqHR SpHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=lC+Mj++3/YMXsXdmajO0Uv+d9BNYm/4DozkgCzMx0BQ=; b=JhQvveGaidqrwnCHVM9Ts9XqEuCoV6ubzbm0NOrYfH/8745FVKJyt0+o0CeKc12dq2 zEgxLjhm9I9jsEUjKQNLR+BPSvcIN0CAO00PH1O3KDOWps8nnBGZ4aMUVTUcWhsIur9f /qVskpK59UvrJugZ0v3jF7jkbOmU9BrCHPY+9W3HLiZpPeT0A/5P3Zf2Mins+KBZuGCN Z4sGHHkj3SoZqA/HHUzI1SIx9ydkWV1S7IJfATYW4kUrto7+P8g6tvrTR5iYgh5ceJqV 2Cpn+XrogA95+xL5IEjpOAz7bmKfHDDhj0SMwVdr40urDexKI8GCHBDhRrgg7c/lsgkw b4AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Ju6xzVVY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w135si3266614oiw.44.2020.02.12.08.42.52; Wed, 12 Feb 2020 08:43:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=Ju6xzVVY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728226AbgBLQmh (ORCPT + 99 others); Wed, 12 Feb 2020 11:42:37 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:45650 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726351AbgBLQmh (ORCPT ); Wed, 12 Feb 2020 11:42:37 -0500 Received: by mail-qk1-f195.google.com with SMTP id a2so2630232qko.12 for ; Wed, 12 Feb 2020 08:42:37 -0800 (PST) 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=lC+Mj++3/YMXsXdmajO0Uv+d9BNYm/4DozkgCzMx0BQ=; b=Ju6xzVVYJuf1V04IsW43lvJOoF0zm1mTaMQ/PSiBynZq6VxAQTaoI3riOkEyS4wYj5 gh5Ky9uPnY3nC77nxWhWbxQic03Y6rTivuXjxT+HHMhOZ7uaMDRHzkCxWsYlNoNOYo+8 R7GvNf8bZSx7zxJVp5YSGq6iFVr09xiXA9jywKHwnqRVB30qmvGW+tRMI0MkyV3kL8VL phfinaVmeAAbzvJWFrOgl6MFfjkH4Lu39AkI6zDv3t+F/9Hjuffz3i1t0fCyPeAGXUds gXYQ6cfasR0c9iDHo+DTD6lbhf4qTFZWsbhW4XKnMOprjGKkrHP2D6dhSVnK35OXS4V7 pWFw== 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=lC+Mj++3/YMXsXdmajO0Uv+d9BNYm/4DozkgCzMx0BQ=; b=rYbRIAZNqYYpxpu69t9VO9Z1Xch0Fj7X/UOmeojnz5T9KVHHmVwYfR0q86zqYDvhnv hsieMW+jrHBzF5HfhqEaKx1YKmVz2bVrcidXQvo4NNskIQx57jvo3dWLt3p5tMJyztTV 36FryUV3zlHafIvIGw9C3kGPKiyp3kConNr/6uCgjB0/ClUS6PP83MpZd1/QgiCRGCj+ tbJDxDxm08bmP1McYInN7/Mz1NKYzEi2yGmHVfhIvrBEqa9gaa0fwKmcintKMUgr+unX gSklWZZ52vtzeygs76TCHPeScL8BQ0QDgXGVMBSw96B/j9zjK/GMiNb4eEd3zXZrUf+f MA8g== X-Gm-Message-State: APjAAAWGbLnKDvY+4MrP8hBJVCbxc3z2YWpTfGm8NAGkCBtt+b7IX2Lp srf3nWtw5zCgrjyxTryBCMiUgQ== X-Received: by 2002:a05:620a:c91:: with SMTP id q17mr11958572qki.168.1581525756526; Wed, 12 Feb 2020 08:42:36 -0800 (PST) Received: from localhost ([2620:10d:c091:500::2:26be]) by smtp.gmail.com with ESMTPSA id v55sm517848qtc.1.2020.02.12.08.42.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2020 08:42:35 -0800 (PST) Date: Wed, 12 Feb 2020 11:42:35 -0500 From: Johannes Weiner To: Yafang Shao Cc: linux-fsdevel@vger.kernel.org, Linux MM , LKML , Dave Chinner , Michal Hocko , Roman Gushchin , Andrew Morton , Linus Torvalds , Al Viro , Kernel Team Subject: Re: [PATCH] vfs: keep inodes with page cache off the inode shrinker LRU Message-ID: <20200212164235.GB180867@cmpxchg.org> References: <20200211175507.178100-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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?