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.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 8EA7BC352A4 for ; Wed, 12 Feb 2020 16:42:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0EF3C20714 for ; Wed, 12 Feb 2020 16:42:38 +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="Ju6xzVVY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EF3C20714 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 8D1866B0467; Wed, 12 Feb 2020 11:42:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 859196B0469; Wed, 12 Feb 2020 11:42:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7474F6B046A; Wed, 12 Feb 2020 11:42:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id 57AC26B0467 for ; Wed, 12 Feb 2020 11:42:38 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 03E16282B for ; Wed, 12 Feb 2020 16:42:38 +0000 (UTC) X-FDA: 76482043596.10.son61_6e38befa4661d X-HE-Tag: son61_6e38befa4661d X-Filterd-Recvd-Size: 5465 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 12 Feb 2020 16:42:37 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id c20so2696313qkm.1 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=OQo1r8SKgZozyVmlXU/XgR6eo0StzcQb03GR7E71xh8QhuGArrykoNfu3khiY1UhE+ +rGBxDyiQDt2/pS/wirQGEfgvVlRsD1NS+mrScQei19LsdIe230xLx8ROgNKzckrwWG5 j0bysaqYZWqF7oGBvFm5ERU2yh/wacGw0l8sbT2j8MaLRPlGuy7g1lvng3yXvgslfQgo 7KM8Z3Xk6IuhGB8eGG1YIlva6yrg0+gDX45N4YfnRL875DPYP8ZgHSB56WuIMjAWX29B FY+iGjv89ypZZFRznag750it3blldLkQTZeQaIsACUg61y+ig2gVkgA01KoG4kAzynP9 IpjQ== X-Gm-Message-State: APjAAAW4HXvycYoQVTwgEcItdhWFuPsFHddHu1J1J0adA5Ucu4Dv71cJ NrNkeXMehLtMJ0U2LkrtPcFZuA== X-Google-Smtp-Source: APXvYqz7V5yTkuSB9pl1fNnJzdUoKrXHVZQvM+wS9anG9Lq+6SvM0jdgqYqGHETcydHb23ay3CgY1A== 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: 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 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?