Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1905582imm; Tue, 10 Jul 2018 09:46:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdS24y+mIeP+aIVWoDIBRcGtJYnQyP2qUEb1MzN4IdHnffnuZXnXLjJSx5wNN0BSnHlBiDz X-Received: by 2002:a63:5922:: with SMTP id n34-v6mr23598824pgb.113.1531241177574; Tue, 10 Jul 2018 09:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531241177; cv=none; d=google.com; s=arc-20160816; b=HTQjBYM9qKSmIYu2+4+F9Oha8vUl2LkwZ4Lrzs6gNmPUuT2S7JeEEI+h3lsBS1bBZC 9lB7Fp2m6BvuIy0xC20YsxetYuLZSxJ6jtN9tTRIdJQyzujolQ+kWO6LbrXc5iqNkZZN QNEdHxPccsCUGSbS8a9l/sow4stlgk+gywMnLmug+mHMS8zE4gUG1SsoO/B0qh8a77Vo ID9T6uq0qYLh76acXz0J5O1XsjVSbAaE6kg7C4MeMorivpMEqKgDPDeQ808E4J1IXFG+ 0KA0vQFyL1WfnIcZ2kg5gWU7Z9zgXPLjpcAQNxgaOXz7pTsVGeHT51yFQYxqwhnSGayF EICA== 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=wKbllpo9IHTAhru3x+KjKLM4KRcotykAbcsWJJyMQIc=; b=tTKGKeeIB5O58De56DCX1BH40BhdGIi6U0xzLVlpnW0Dlpm+7KTq2sEAMSF34M5PMA 8LxckhY/dA5y6iHZhQlKxYuS5bugraZ4krF+EDsCPYbEnrQB4VvhESLrmP7p3EA5tWay xlm6Ot5VK3/VENE+BD9oQYCv+ltcPkaRr/SS3YrlU2cyviy6b3nItTZFfbPN2mPt/mwP KMGlAkzQGg3PqHM1z1HokTzCN1EyanCAnDWtYtgYEvmrdsvQroUwPacNz7WVzK4/TfhP Fya8zI/KRkV/CIT/OUmJEvw7MlUR6zfz2pp8WAmwAD01tsYQ+0j6kfvoLg14ObvWTZdz hTtw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4-v6si15899839pgv.621.2018.07.10.09.46.01; Tue, 10 Jul 2018 09:46:17 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933687AbeGJO1q (ORCPT + 99 others); Tue, 10 Jul 2018 10:27:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:42036 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933280AbeGJO1o (ORCPT ); Tue, 10 Jul 2018 10:27:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 533DFADEC; Tue, 10 Jul 2018 14:27:41 +0000 (UTC) Date: Tue, 10 Jul 2018 16:27:40 +0200 From: Michal Hocko To: Waiman Long Cc: Alexander Viro , Jonathan Corbet , "Luis R. Rodriguez" , Kees Cook , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, Linus Torvalds , Jan Kara , "Paul E. McKenney" , Andrew Morton , Ingo Molnar , Miklos Szeredi , Matthew Wilcox , Larry Woodman , James Bottomley , "Wangkai (Kevin C)" Subject: Re: [PATCH v6 0/7] fs/dcache: Track & limit # of negative dentries Message-ID: <20180710142740.GQ14284@dhcp22.suse.cz> References: <1530905572-817-1-git-send-email-longman@redhat.com> <20180709081920.GD22049@dhcp22.suse.cz> <62275711-e01d-7dbe-06f1-bf094b618195@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <62275711-e01d-7dbe-06f1-bf094b618195@redhat.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 09-07-18 12:01:04, Waiman Long wrote: > On 07/09/2018 04:19 AM, Michal Hocko wrote: [...] > > later needs a special treatment while the first one is ok? There are > > quite some resources which allow a non privileged user to consume a lot > > of memory and the memory controller is the only reliable way to mitigate > > the risk. > > Yes, memory controller is the only reliable way to mitigate the risk, > but not all tasks are under the control of a memory controller with > kernel memory limit. But those which you do not trust should. So why do we need yet another mechanism for the reclaim? [...] > >> Patch 1 tracks the number of negative dentries present in the LRU > >> lists and reports it in /proc/sys/fs/dentry-state. > > If anything I _think_ vmstat would benefit from this because behavior of > > the memory reclaim does depend on the amount of neg. dentries. > > > >> Patch 2 adds a "neg-dentry-pc" sysctl parameter that can be used to to > >> specify a soft limit on the number of negative allowed as a percentage > >> of total system memory. This parameter is 0 by default which means no > >> negative dentry limiting will be performed. > > percentage has turned out to be a really wrong unit for many tunables > > over time. Even 1% can be just too much on really large machines. > > Yes, that is true. Do you have any suggestion of what kind of unit > should be used? I can scale down the unit to 0.1% of the system memory. > Alternatively, one unit can be 10k/cpu thread, so a 20-thread system > corresponds to 200k, etc. I simply think this is a strange user interface. How much is a reasonable number? How can any admin figure that out? > >> Patch 3 enables automatic pruning of least recently used negative > >> dentries when the total number is close to the preset limit. > > Please explain why this cannot be done in a standard dcache shrinking > > way. I strongly suspect that you are developing yet another reclaim with > > its own sets of tunable and bypassing the existing infrastructure. I > > haven't read patches yet but the cover letter doesn't really explain > > design much so I am only guessing. > > The standard dcache shrinking happens when the system is almost running > out of free memory. Well, the standard reclaim happens when somebody needs memory. We are usually quite far away from "almost running out of memory". We do reclaim fs metadata including dentries so I really do not see why negative ones should be any special here. > This new shrinker will be turned on when the number > of negative dentries is closed to the limit even when there are still > plenty of free memory left. It will stop when the number of negative > dentries is lowered to a safe level. The new shrinker is designed to > impose as little overhead to the currently running tasks. That is not > true for the standard shrinker which will have a rather significant > performance impact to the currently running tasks. Do you have any numbers to back your claim? The memory reclaim is usually quite lightweight. Especially when we have a lot of clean fs {meta}data > I can remove the new shrinker if people really don't want to add a new > one as long as I can keep the option to kill off newly created negative > dentries when the limit is exceeded. Please let's not add yet another memory reclaim mechanism. It will just backfire sooner or later. -- Michal Hocko SUSE Labs