From owner-freebsd-fs@FreeBSD.ORG Tue Oct 8 06:34:36 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7D6ADFE6 for ; Tue, 8 Oct 2013 06:34:36 +0000 (UTC) (envelope-from pho@holm.cc) Received: from relay02.pair.com (relay02.pair.com [209.68.5.16]) by mx1.freebsd.org (Postfix) with SMTP id 337F72703 for ; Tue, 8 Oct 2013 06:34:35 +0000 (UTC) Received: (qmail 39690 invoked from network); 8 Oct 2013 06:34:34 -0000 Received: from 87.58.146.155 (HELO x2.osted.lan) (87.58.146.155) by relay02.pair.com with SMTP; 8 Oct 2013 06:34:34 -0000 X-pair-Authenticated: 87.58.146.155 Received: from x2.osted.lan (localhost [127.0.0.1]) by x2.osted.lan (8.14.5/8.14.5) with ESMTP id r986YXoK048149; Tue, 8 Oct 2013 08:34:33 +0200 (CEST) (envelope-from pho@x2.osted.lan) Received: (from pho@localhost) by x2.osted.lan (8.14.5/8.14.5/Submit) id r986YXSb048148; Tue, 8 Oct 2013 08:34:33 +0200 (CEST) (envelope-from pho) Date: Tue, 8 Oct 2013 08:34:33 +0200 From: Peter Holm To: Davide Italiano Subject: Re: Call fo comments - raising vfs.ufs.dirhash_reclaimage? Message-ID: <20131008063433.GA47506@x2.osted.lan> References: <20130828181228.0d3618dd@ernst.home> <201309031507.33098.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Kirk McKusick , alc@freebsd.org, freebsd-hackers , freebsd-fs@freebsd.org, Ivan Voras X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2013 06:34:36 -0000 On Mon, Oct 07, 2013 at 07:34:24PM +0200, Davide Italiano wrote: > > What would perhaps be better than a hardcoded reclaim age would be to use > > an LRU-type approach and perhaps set a target percent to reclaim. That is, > > suppose you were to reclaim the oldest 10% of hashes on each lowmem call > > (and make the '10%' the tunable value). Then you will always make some amount > > of progress in a low memory situation (and if the situation remains dire you > > will eventually empty the entire cache), but the effective maximum age will > > be more dynamic. Right now if you haven't touched UFS in 5 seconds it > > throws the entire thing out on the first lowmem event. The LRU-approach would > > only throw the oldest 10% out on the first call, but eventually throw it all out > > if the situation remains dire. > > > > -- > > John Baldwin > > _______________________________________________ > > freebsd-fs@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org" > > I liked your idea more than what's available in HEAD right now and I > implemented it. > http://people.freebsd.org/~davide/review/ufs_direclaimage.diff > I was unsure what kind of heuristic I should choose to select which > (10% of) entries should be evicted so I just removed the first 10% > ones from the head of the ufs_dirhash list (which should be the > oldest). > The code keeps rescanning the cache until 10% (or, the percentage set > via SYSCTL) of the entry are freed, but probably we can discuss if > this limit could be relaxed and just do a single scan over the list. > Unfortunately I haven't a testcase to prove the effectiveness (or > non-effectiveness) of the approach but I think either Ivan or Peter > could be able to give it a spin, maybe. > I gave this patch a spin for 12 hours without finding any problems. I can do more testing at a later time, if you want to. - Peter