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.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 365D7C3F2D3 for ; Fri, 28 Feb 2020 15:47:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02C3A246AE for ; Fri, 28 Feb 2020 15:47:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JVg/n2sI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgB1PrU (ORCPT ); Fri, 28 Feb 2020 10:47:20 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:37859 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727115AbgB1PrU (ORCPT ); Fri, 28 Feb 2020 10:47:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582904839; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M5VyH6QG78kcYA9fsol/765vHxQ9ZwPBQuyaapR5VWs=; b=JVg/n2sIcC4IqXWiBfR9uLTCNULrI0+Vf20qfHIfrCtL3fW2OEOBMWhc6bOWE5LDSKCCXB a8f90gbhO4svQ3rEoEG7xByaAafSkxniwCLU8J4+9klQG/0dujCsEWEkrxXAUNV5JN09FC qs0A97rdAzw9XYPhhJLWGVz0byOIS/A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-mQ_0rQDoOnSMA1s8I2K5_w-1; Fri, 28 Feb 2020 10:47:14 -0500 X-MC-Unique: mQ_0rQDoOnSMA1s8I2K5_w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 51DB4107ACC5; Fri, 28 Feb 2020 15:47:12 +0000 (UTC) Received: from llong.remote.csb (ovpn-123-107.rdu2.redhat.com [10.10.123.107]) by smtp.corp.redhat.com (Postfix) with ESMTP id C300390793; Fri, 28 Feb 2020 15:47:08 +0000 (UTC) Subject: Re: [PATCH 00/11] fs/dcache: Limit # of negative dentries To: Dave Chinner Cc: Alexander Viro , Jonathan Corbet , Luis Chamberlain , Kees Cook , Iurii Zaikin , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, Mauro Carvalho Chehab , Eric Biggers , Eric Sandeen References: <20200226161404.14136-1-longman@redhat.com> <20200227083029.GL10737@dread.disaster.area> From: Waiman Long Organization: Red Hat Message-ID: Date: Fri, 28 Feb 2020 10:47:07 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20200227083029.GL10737@dread.disaster.area> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 2/27/20 3:30 AM, Dave Chinner wrote: > On Wed, Feb 26, 2020 at 11:13:53AM -0500, Waiman Long wrote: >> As there is no limit for negative dentries, it is possible that a sizeable >> portion of system memory can be tied up in dentry cache slabs. Dentry slabs >> are generally recalimable if the dentries are in the LRUs. Still having >> too much memory used up by dentries can be problematic: > I don't get it. > > Why isn't the solution simply "constrain the application generating > unbound numbers of dentries to a memcg"? > > Then when the memcg runs out of memory, it will start reclaiming the > dentries that were allocated inside the memcg that are using all > it's resources, thereby preventing unbound growth of the dentry > cache. > > I mean, this sort of resource control is exactly what memcgs are > supposed to be used for and are already used for. I don't see why we > need all this complexity for global dentry resource management when > memcgs should already provide an effective means of managing and > placing bounds on the amount of memory any specific application can > use... Using memcg is one way to limit the damage. The argument that excessive negative dentries can push out existing memory objects that can be more useful if left alone still applies. Daemons that run in the root memcg has no limitation on how much memory that they can use. There can also be memcgs with high memory limits and long running applications. memcg is certainly a useful tool in this regards, but it doesn't solve all the problem. Cheers, Longman