From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [patch] fs: use fast counters for vfs caches Date: Thu, 9 Dec 2010 16:43:43 +1100 Message-ID: <20101209054343.GA8259@dastard> References: <20101129105733.GA3241@amd> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds , Al Viro , Christoph Hellwig To: Nick Piggin Return-path: Received: from bld-mail16.adl2.internode.on.net ([150.101.137.101]:60078 "EHLO mail.internode.on.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751861Ab0LIFpD (ORCPT ); Thu, 9 Dec 2010 00:45:03 -0500 Content-Disposition: inline In-Reply-To: <20101129105733.GA3241@amd> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Nov 29, 2010 at 09:57:33PM +1100, Nick Piggin wrote: > Hey, > > What was the reason behind not using my approach to use fast per-cpu > counters for inode and dentry counters, and instead using the > percpu_counter lib (which is not useful unless very fast approximate > access to the global counter is required, or performance is not > critical, which is somewhat of an oxymoron if you're using per-counters > in the first place). It is a difference between this: Hi Nick - sorry for being slow to answer this - I only just found this email. The reason for using the generic counters is because the shrinkers read the current value of the global counter on every call and hence they can be read thousands of times a second. The only way to do that efficiently is to use the approximately value the generic counters provide. IIRC, it's also used in a couple of places in the writeback code as well, but that is significantly fewer reads of the summed value. It's probably best to revisit this once the shrinkers no longer use a global counter value. Cheers, Dave. -- Dave Chinner david@fromorbit.com