From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752616AbdIAWv5 (ORCPT ); Fri, 1 Sep 2017 18:51:57 -0400 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 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6166381DF2 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dhowells@redhat.com Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 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> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 01 Sep 2017 22:51:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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