From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rusty Russell Subject: Re: [PATCH 23/32] Generic dynamic per cpu refcounting Date: Fri, 25 Jan 2013 16:45:10 +1030 Message-ID: <87libhpz4h.fsf@rustcorp.com.au> References: <1356573611-18590-1-git-send-email-koverstreet@google.com> <1356573611-18590-26-git-send-email-koverstreet@google.com> <20130125005136.GE2373@mtj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, zab@redhat.com, bcrl@kvack.org, jmoyer@redhat.com, axboe@kernel.dk, viro@zeniv.linux.org.uk, tytso@mit.edu, Oleg Nesterov , srivatsa.bhat@linux.vnet.ibm.com, Christoph Lameter , "Paul E. McKenney" To: Tejun Heo , Kent Overstreet Return-path: Received: from ozlabs.org ([203.10.76.45]:50365 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750961Ab3AYGQI (ORCPT ); Fri, 25 Jan 2013 01:16:08 -0500 In-Reply-To: <20130125005136.GE2373@mtj.dyndns.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Tejun Heo writes: >> It also implements two stage shutdown, as we need it to tear down the >> percpu counts. Before dropping the initial refcount, you must call >> percpu_ref_kill(); this puts the refcount in "shutting down mode" and >> switches back to a single atomic refcount with the appropriate barriers >> (synchronize_rcu()). > > Maybe if we have tryget() which only succeeds if the counter is alive, > we can replace moulde refcnt with this? Rusty? Yes, it's similar (hence my previous interest), though module count is a bit weird. Like Tejun, I'd prefer to see it always alloc up-front, because it avoids the _noalloc variant (which is backwards: please hand gfp_t, so you don't hide the alloc) and heuristics. Cheers, Rusty.