From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283AbdIDHa0 (ORCPT ); Mon, 4 Sep 2017 03:30:26 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:59360 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751949AbdIDHaZ (ORCPT ); Mon, 4 Sep 2017 03:30:25 -0400 Date: Mon, 4 Sep 2017 09:30:20 +0200 From: Peter Zijlstra To: David Howells Cc: linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions Message-ID: <20170904073020.jrayxderjzchk2g5@hirez.programming.kicks-ass.net> References: <20170901215003.GA17526@worktop.programming.kicks-ass.net> <20170901164233.wu4fdljpivzf5idb@hirez.programming.kicks-ass.net> <150428045304.25051.1778333106306853298.stgit@warthog.procyon.org.uk> <150428046185.25051.3518486828049323804.stgit@warthog.procyon.org.uk> <3696.1504300539@warthog.procyon.org.uk> <15137.1504306313@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15137.1504306313@warthog.procyon.org.uk> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 01, 2017 at 11:51:53PM +0100, David Howells wrote: > Peter Zijlstra wrote: > > > if (obj) { > > /* use obj */ > > refcount_dec(&obj->refs); /* should never hit 0 */ > > } > > You've missed a bit: We need to tell the gc to run when we reduce the refcount > to 1: > > if (obj) { > ... > if (refcount_dec_return(&obj->refs) == 1) > schedule_gc(); > } Ah, so that isn't fundamental to having a GC. But yes if that's your requirement, then this makes sense. Please clarify in the Changelog.