Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:54374 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbdIAWvz (ORCPT ); Fri, 1 Sep 2017 18:51:55 -0400 From: David Howells In-Reply-To: <20170901215003.GA17526@worktop.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> To: Peter Zijlstra Cc: dhowells@redhat.com, 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15136.1504306313.1@warthog.procyon.org.uk> Date: Fri, 01 Sep 2017 23:51:53 +0100 Message-ID: <15137.1504306313@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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(); } David