Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1126713imm; Wed, 18 Jul 2018 17:34:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeAkOYhxIVZxRTvUBTxJV0vtn5CmKWY9u4PK2pXj8tXw2hkXcGqWUqSkKMMQMnTfey5J089 X-Received: by 2002:a65:4304:: with SMTP id j4-v6mr7978055pgq.109.1531960462618; Wed, 18 Jul 2018 17:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531960462; cv=none; d=google.com; s=arc-20160816; b=c27YP5c4X09VZfUg1pvHf88uAyVvZLIt2jycZvENY/GPtbJjIbtVydYk7zD7eq5mfS sbtiMQNF8NBL41d2cmByraU0BHgC+/0d0dZiw7zRGVRp6dgs/UNlq/cq+3i9IzdGYOnj L5GtEn9KHlTFmozmeZUt2wBOeDkHyOO7CHJ+en2x2GQTwT79/jCogZgCJQhc8FfLYEwo rbjUb9wUqz42idLAvq9GGlnps/CiZxiGv+x6svwD9l66sS3xQF/fvBZH0Kz8s3C+OoE0 XysZj1WXFi+b7+VTA2+kOCHWPDcsAGXHj7TrYjhjI489RFBq3YlHtSDGO7zE4anv2GG5 EwrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=nCkCiB6VxOoKgOECscmv5tU1rddq+AXlLdtkdrCuxek=; b=HkNfMruWItsqn1XAbq+H4CaefnBQ19PzwpPFoMQJKOZlT0HsohdYSyyHt7cDiBgqdZ UNWKr9dOnYQ2nh/JNestUmPfUsj9ICgq1SKfpEG4RS0XnBjmj/SVQQzNH2nuCNnEsnnw ePx4FMNqBsiPzMaKh3AkDhk+mg8UzpO8Fh25fMw2PibqqXScBPQPVjoMTPr93T0kkK9p LXyXK3UxenF0z3bMWf2anNLwNmGC+x//QKI3Jn6V5tbz29+XIwpvZz2TmRyJCtg8RLef xmVZD51r7XMKuDnbpMHwVdn1RZa89VRDU+wBNSxRd0YEGbcSINFVwN0yp0bOcX8Gfr34 hclw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j30-v6si4634286pgm.26.2018.07.18.17.34.07; Wed, 18 Jul 2018 17:34:22 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730234AbeGSBOA (ORCPT + 99 others); Wed, 18 Jul 2018 21:14:00 -0400 Received: from ipmail02.adl2.internode.on.net ([150.101.137.139]:53704 "EHLO ipmail02.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729309AbeGSBOA (ORCPT ); Wed, 18 Jul 2018 21:14:00 -0400 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail02.adl2.internode.on.net with ESMTP; 19 Jul 2018 10:03:30 +0930 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1ffwsr-0004uB-MN; Thu, 19 Jul 2018 10:33:29 +1000 Date: Thu, 19 Jul 2018 10:33:29 +1000 From: Dave Chinner To: Michal Hocko Cc: Andrew Morton , Matthew Wilcox , James Bottomley , Linus Torvalds , Waiman Long , Al Viro , Jonathan Corbet , "Luis R. Rodriguez" , Kees Cook , Linux Kernel Mailing List , linux-fsdevel , linux-mm , "open list:DOCUMENTATION" , Jan Kara , Paul McKenney , Ingo Molnar , Miklos Szeredi , Larry Woodman , "Wangkai (Kevin,C)" Subject: Re: [PATCH v6 0/7] fs/dcache: Track & limit # of negative dentries Message-ID: <20180719003329.GD19934@dastard> References: <1531411494.18255.6.camel@HansenPartnership.com> <20180712164932.GA3475@bombadil.infradead.org> <1531416080.18255.8.camel@HansenPartnership.com> <1531425435.18255.17.camel@HansenPartnership.com> <20180713003614.GW2234@dastard> <20180716090901.GG17280@dhcp22.suse.cz> <20180716124115.GA7072@bombadil.infradead.org> <20180716164032.94e13f765c5f33c6022eca38@linux-foundation.org> <20180717083326.GD16803@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180717083326.GD16803@dhcp22.suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 17, 2018 at 10:33:26AM +0200, Michal Hocko wrote: > On Mon 16-07-18 16:40:32, Andrew Morton wrote: > > On Mon, 16 Jul 2018 05:41:15 -0700 Matthew Wilcox wrote: > > It's quite a small code change and would provide a mechanism for > > implementing the hammer-cache-until-youve-freed-enough design above. > > > > > > > > Aside 2: if we *do* do something like the above __d_alloc() pseudo code > > then perhaps it could be cast in terms of pages, not dentries. ie, > > > > __d_alloc() > > { > > ... > > while (too many pages in dentry_cache) > > call the dcache shrinker > > ... > > } Direct reclaim will result in all the people who care about long tail latencies and/or highly concurent workloads starting to hate you. Direct reclaim already hammers superblock shrinkers with excessive concurrency, this would only make it worse. IOWs, anything like this needs to co-ordinate with other reclaim operations in progress and, most likely, be done via background reclaim processing rather than blocking new allocations indefinitely. background processing can be done in bulk and as efficiently as possible - concurrent direct reclaim in tiny batches will just hammer dcache locks and destroy performance when there is memory pressure. How many times do we have to learn this lesson the hard way? > > and, apart from the external name thing (grr), that should address > > these fragmentation issues, no? I assume it's easy to ask slab how > > many pages are presently in use for a particular cache. > > I remember Dave Chinner had an idea how to age dcache pages to push > dentries with similar live time to the same page. Not sure what happened > to that. Same thing that happened to all the "select the dentries on this page for reclaim". i.e. it's referenced dentries that we can't reclaim or move that are the issue, not the reclaimable dentries on the page. Bsaically, without a hint at allocation time as to the expected life time of the dentry, we can't be smart about how we select partial pages to allocate from. And because we don't know at allocation time if the dentry is going to remain a negative dentry or not, we can't provide a hint about expected lifetime of teh object being allocated. Cheers, Dave. -- Dave Chinner david@fromorbit.com