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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 770FBECDFAA for ; Sat, 14 Jul 2018 18:37:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 308692083D for ; Sat, 14 Jul 2018 18:37:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 308692083D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ZenIV.linux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731239AbeGNS44 (ORCPT ); Sat, 14 Jul 2018 14:56:56 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:36308 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbeGNS44 (ORCPT ); Sat, 14 Jul 2018 14:56:56 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fePPd-0004Es-Ac; Sat, 14 Jul 2018 18:36:57 +0000 Date: Sat, 14 Jul 2018 19:36:57 +0100 From: Al Viro To: Linus Torvalds Cc: Pavel Machek , Jan Kara , Andrew Morton , James Bottomley , Waiman Long , Linux Kernel Mailing List , linux-fsdevel , Paul McKenney , Ingo Molnar , Miklos Szeredi , Matthew Wilcox , Larry Woodman , "Wangkai (Kevin,C)" , linux-mm , Michal Hocko Subject: Re: [PATCH v5 0/6] fs/dcache: Track & limit # of negative dentries Message-ID: <20180714183657.GK30522@ZenIV.linux.org.uk> References: <1530510723-24814-1-git-send-email-longman@redhat.com> <20180702141811.ef027fd7d8087b7fb2ba0cce@linux-foundation.org> <1530570880.3179.9.camel@HansenPartnership.com> <20180702161925.1c717283dd2bd4a221bc987c@linux-foundation.org> <20180703091821.oiywpdxd6rhtxl4p@quack2.suse.cz> <20180714173516.uumlhs4wgfgrlc32@devuan> <20180714183445.GJ30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180714183445.GJ30522@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 14, 2018 at 07:34:45PM +0100, Al Viro wrote: > On Sat, Jul 14, 2018 at 11:00:32AM -0700, Linus Torvalds wrote: > > On Sat, Jul 14, 2018 at 10:35 AM Pavel Machek wrote: > > > > > > Could we allocate -ve entries from separate slab? > > > > No, because negative dentrires don't stay negative. > > > > Every single positive dentry starts out as a negative dentry that is > > passed in to "lookup()" to maybe be made positive. > > > > And most of the time they do turn positive, because most of the > > time people actually open files that exist. > > > > But then occasionally you don't, because you're just blindly opening a > > filename whether it exists or not (to _check_ whether it's there). > > BTW, one point that might not be realized by everyone: negative dentries > are *not* the hard case. > mount -t tmpfs none /mnt > touch /mnt/a > for i in `seq 100000`; do ln /mnt/a /mnt/$i; done > > and you've got 100000 *unevictable* dentries, with the time per iteration > being not all that high (especially if you just call link(2) in a loop). > They are all positive and all pinned. And you've got only one inode > there and no persistently opened files, so rlimit and quota won't help > any. OK, this /* * No ordinary (disk based) filesystem counts links as inodes; * but each new link needs a new dentry, pinning lowmem, and * tmpfs dentries cannot be pruned until they are unlinked. */ ret = shmem_reserve_inode(inode->i_sb); if (ret) goto out; will probably help (on ramfs it won't, though).