public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Arjan van de Ven <arjan@infradead.org>, Greg KH <greg@kroah.com>,
	Sergey Vlasov <vsu@altlinux.ru>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] New operation for kref to help avoid locks
Date: Tue, 01 Mar 2005 18:28:22 -0600	[thread overview]
Message-ID: <422508A6.9070605@acm.org> (raw)
In-Reply-To: <42250299.8080709@yahoo.com.au>

Nick Piggin wrote:

> Corey Minyard wrote:
>
>> Arjan van de Ven wrote:
>>
>>>> Just doing an atomic operation is not faster than doing a lock, an 
>>>> atomic operation, then an unlock?  Am I missing something?
>>>>   
>>>
>>>
>>>
>>> if the lock and the atomic are on the same cacheline they're the same
>>> cost on most modern cpus...
>>>  
>>>
>> Ah, I see.  Not likely to ever be the case with this.  The lock will 
>> likely be with the main data structure (the list, or whatever) and 
>> the refcount will be in the individual item in the main data 
>> structure (list entry).
>>
>
> Is get_with_check actually going to be useful for anything? It
> seems like it promotes complex and potentially unsafe schemes.

It is certainly more complex to use this, and I'm guessing that's why 
Greg rejected it.  Certainly a valid problem.

>
> eg. In your queue example, it would usually be better to have
> a refcount for being on queue, and entry_completed would remove
> the entry from the queue and accordingly drop the refcount. The
> release function would then just free it.

True.  But if things picked up entries of the queue and incremented 
their refcount, then you would need a lock.  The same technique would 
apply.  But your example would be the more common one, I would think.

Thanks,

-Corey

  reply	other threads:[~2005-03-02  0:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-26 15:55 [PATCH] New operation for kref to help avoid locks Corey Minyard
2005-02-26 20:20 ` Sergey Vlasov
2005-02-26 22:23   ` Corey Minyard
2005-03-01 20:15     ` Greg KH
2005-03-01 21:02       ` Arjan van de Ven
2005-03-01 21:24         ` Greg KH
2005-03-01 21:54         ` Corey Minyard
2005-03-01 22:14           ` Arjan van de Ven
2005-03-01 23:35             ` Corey Minyard
2005-03-02  0:02               ` Nick Piggin
2005-03-02  0:28                 ` Corey Minyard [this message]
2005-03-02  0:34                   ` Nick Piggin

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=422508A6.9070605@acm.org \
    --to=minyard@acm.org \
    --cc=arjan@infradead.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=vsu@altlinux.ru \
    /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