public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <piggin@cyberone.com.au>
To: Andrew Morton <akpm@osdl.org>
Cc: greg@kroah.com, linux-kernel@vger.kernel.org, ak@suse.de
Subject: Re: [RFC] kref, a tiny, sane, reference count object
Date: Sun, 14 Mar 2004 15:20:50 +1100	[thread overview]
Message-ID: <4053DDA2.1030708@cyberone.com.au> (raw)
In-Reply-To: <20040313201017.775ab48b.akpm@osdl.org>



Andrew Morton wrote:

>Nick Piggin <piggin@cyberone.com.au> wrote:
>
>>
>>
>>Andrew Morton wrote:
>>
>>
>>>Greg KH <greg@kroah.com> 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.
>>
>
>Well it does more than that, such as trapping the hard-to-diagnose bug
>of grabbing a refcount against a zero-ref object.
>
>
>>And you get more flexibility by being able to use atomic_set
>>directly too.
>>
>
>Do I care about that?  I care more about being able to say "ah, it uses
>kref.  I understand that refcounting idiom, I know it's well debugged and I
>know that it traps common errors".  That's better than "oh crap, this thing
>implements its own refcounting - I need to review it for the usual
>errors".
>
>

OK good point.


  reply	other threads:[~2004-03-14  4:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-13  8:20 [RFC] kref, a tiny, sane, reference count object Greg KH
2004-03-13  8:21 ` [PATCH] convert usb-serial core to use kref instead of kobject Greg KH
2004-03-14  0:34 ` [RFC] kref, a tiny, sane, reference count object Andrew Morton
2004-03-14  2:55   ` Greg KH
2004-03-14  3:30   ` Nick Piggin
2004-03-14  4:10     ` Andrew Morton
2004-03-14  4:20       ` Nick Piggin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-13  9:10 Peter Kjellerstedt
2004-03-13 18:15 ` Greg KH
     [not found] <1zcH2-KO-11@gated-at.bofh.it>
2004-03-13 13:06 ` Andi Kleen
2004-03-13 18:14   ` Greg KH
     [not found] <1zhdz-5uL-3@gated-at.bofh.it>
     [not found] ` <1zhdz-5uL-1@gated-at.bofh.it>
     [not found]   ` <1zm3F-2ex-7@gated-at.bofh.it>
2004-03-13 20:43     ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4053DDA2.1030708@cyberone.com.au \
    --to=piggin@cyberone.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox