Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp796268ybf; Fri, 28 Feb 2020 07:49:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxHnxOpIFfBP+dSZFQbDg00B3UniSxwFbepVhCSlmoyVllTKSuHtJ4kEpq1trDGNEJBt6rF X-Received: by 2002:a9d:6a9a:: with SMTP id l26mr2619801otq.104.1582904942518; Fri, 28 Feb 2020 07:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582904942; cv=none; d=google.com; s=arc-20160816; b=zsjKefE4VqLvodetbiCYXOJxDZTWS9WJg8F51MWPeCyYLvh/GZkDPsnXwy1Qk3APkF 6lEacf4uKES5DjGE7ls64rWQ6OYkD7UY3AMJVY0vQ8ZNp13eE+FYwdvMTkPM5z7TkSkU zk/udtRA3FcpnGgasUAQ+LTc8Guwi+H/Kg1kRWgrHwZxSQPGGPnODPYViIBr2WE9LER/ y4wiDlClqeu/pzvI91CJP21a9mP/Ygkc9Y6YGZuVpDWBqQ8EFaL1HWKViDjtP4AAhntc qZChX0+AoTYRfSOm4ZQJbm01VBdqe/TzBfUizoXe6DQWJOylz11CFPsorYBiSI8/IJs+ rmMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=M5VyH6QG78kcYA9fsol/765vHxQ9ZwPBQuyaapR5VWs=; b=FEWmxWjGi/MkKOkNQSHP23puUtGUKuOgSLAdMcjOLzS78k1uyuS8pL3VLgJFuHc1W3 /TNe4YFraqo5tW8t+UaJAiDEBrDluBIbUt42okuqXwgzKioF9NygZhCbsI9SoGk3aE3Z oAG6JcBdO+irRreOZcs1neu8iV2g64daYe5S8n2r7f1VoChyvvKsoaZllmQMO1TaEQ8n wV85I0tEpSNS64f4s5vSdA5u8KyVIzM/3cYLQi5vI6Wb+vGIOUuVE7IKiT73asEfQZm7 5gIg+FNS+yAFDVHNGg6PPc+nzcgTv35FOLvqG/XFoi6GPILZF+lZLqsGMbpqVnCZQyw1 ASuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="JVg/n2sI"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o6si1986271oic.34.2020.02.28.07.48.49; Fri, 28 Feb 2020 07:49:02 -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=@redhat.com header.s=mimecast20190719 header.b="JVg/n2sI"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbgB1PrV (ORCPT + 99 others); Fri, 28 Feb 2020 10:47:21 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57991 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727120AbgB1PrU (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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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