From owner-freebsd-fs@FreeBSD.ORG Mon Oct 7 17:34:27 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4CE9C57C; Mon, 7 Oct 2013 17:34:27 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-x231.google.com (mail-vc0-x231.google.com [IPv6:2607:f8b0:400c:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8E951244B; Mon, 7 Oct 2013 17:34:26 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id hv10so2981185vcb.8 for ; Mon, 07 Oct 2013 10:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=vwvLFqEb9U3hPhbAAIAXI33/t4DokjslzkbwD0tEOEE=; b=B5D5qdgZjOLI4OvC4CfkONMBr1HebyTvBJN677fjR3J3rsr856MBtJAcRSywS4z+jW xdlksiBjabW1pa/ea99ZCpjb6goYfU+FwLTzWaTwgFLs3g5fkeD6UWm6db/7qL8lah7L xGhszWNNx3agaqjcqDKdK9v/ejtTGnG6iGEEmp6EHkWQq1cIRj44OEuy6Qcdmn4AKTO3 kKBJbdGYpR305Ks/245FGjbVRRh9cWfNrJVzdB5x5dZiwINplxwj35dxBkTyTA6XZniu JEQzSV9c03/LGcaemMvS9Vf87E1QR7rfSMa5cjLjLOKoeuQm3KHy0EbsiXH/W+cXCLjo r18A== MIME-Version: 1.0 X-Received: by 10.221.44.136 with SMTP id ug8mr27375118vcb.13.1381167265028; Mon, 07 Oct 2013 10:34:25 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.94.71 with HTTP; Mon, 7 Oct 2013 10:34:24 -0700 (PDT) In-Reply-To: <201309031507.33098.jhb@freebsd.org> References: <20130828181228.0d3618dd@ernst.home> <201309031507.33098.jhb@freebsd.org> Date: Mon, 7 Oct 2013 19:34:24 +0200 X-Google-Sender-Auth: JQDCy-MSqtcuvUVwEdRZlUXTzvU Message-ID: Subject: Re: Call fo comments - raising vfs.ufs.dirhash_reclaimage? From: Davide Italiano To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Cc: Kirk McKusick , alc@freebsd.org, freebsd-hackers , freebsd-fs@freebsd.org, Ivan Voras , pho@freebsd.org 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: Mon, 07 Oct 2013 17:34:27 -0000 > 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. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare