Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263264AbUCNDbJ (ORCPT ); Sat, 13 Mar 2004 22:31:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263267AbUCNDbJ (ORCPT ); Sat, 13 Mar 2004 22:31:09 -0500 Received: from mail-01.iinet.net.au ([203.59.3.33]:36812 "HELO mail.iinet.net.au") by vger.kernel.org with SMTP id S263264AbUCNDbG (ORCPT ); Sat, 13 Mar 2004 22:31:06 -0500 Message-ID: <4053D1EB.1070108@cyberone.com.au> Date: Sun, 14 Mar 2004 14:30:51 +1100 From: Nick Piggin User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040122 Debian/1.6-1 X-Accept-Language: en MIME-Version: 1.0 To: Andrew Morton CC: Greg KH , linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [RFC] kref, a tiny, sane, reference count object References: <20040313082003.GA13084@kroah.com> <20040313163451.3c841ac2.akpm@osdl.org> In-Reply-To: <20040313163451.3c841ac2.akpm@osdl.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 752 Lines: 31 Andrew Morton wrote: >Greg KH wrote: > >>For all of those people, this patch is for you. >> > >It does rather neatly capture a common idiom. > But as Andi said - look at all the crap involved when: atomic_inc(); if (atomic_dec_and_test()) release(); Also neatly captures that idiom. And you get more flexibility by being able to use atomic_set directly too. But if you really like it, I agree it shouldn't allow NULL pointers and probably get, put and cleanup should be inline. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/