From: Ravikiran G Thirumalai <kiran@in.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, dipankar@in.ibm.com
Subject: Re: [RFC] Refcounting of objects part of a lockfree collection
Date: Fri, 16 Jul 2004 21:20:49 +0530 [thread overview]
Message-ID: <20040716155049.GC1257@obelix.in.ibm.com> (raw)
In-Reply-To: <20040716143235.GC8282@kroah.com>
On Fri, Jul 16, 2004 at 07:32:35AM -0700, Greg KH wrote:
>...
> > We (Dipankar and myslef) had a discussion
> > and decided:
> > 1. I will make a patch to shrink kref and feed it to Greg
> > 2. Add new set kref api for lockfree refcounting --
> > kref_lf_xxx. (kref_lf_get, kref_lf_get_rcu etc.,)
>
> kref_*_rcu() as Dipankar noted is much nicer.
Do you mean Dipankar had noted as in:
<Dipankar's earlier post>
> Would this work -
>
> kref_get - just atomic inc
> kref_put - just atomic dec
> kref_get_rcu - cmpxchg if arch has or hashed spinlock
> kref_put_rcu - dec if has cmpxchg else hashed spinlock
> If the object has lock-free look-up, it must use kref_get_rcu.
> You can use kref_get on such an object if the look-up is being
> done with lock. Is there a situation that is not covered by this ?
</>
If that is what you want, the api cannot work well.
The problem with this case is I cannot use hashed spinlock _just_ for
kref_get_rcu as Dipankar mentions above. If I do that the atomic_inc s
in kref_get will race with the 'hashed spinlock' kref_get_rcu when
both have to be used on the same refcounter. (I mentioned this in an
earlier post). So I have to take the same hashed spinlock for kref_gets as
well to maintain correctness -- obviously not a good thing for arches
with no cmpxchg which use krefs for non lock free purposes only.
Hence, the proposal now is to add kref_lf_get, kref_lf_put, kref_lf_get_rcu
to the kref api. kref_lf_xxx is to be used when the kref refcounter
is used atleast one place lock free -- that is kref_lf_get_rcu is used
at atleast once on the struct kref. Does that sound ok?
Thanks,
Kiran
next prev parent reply other threads:[~2004-07-16 15:51 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-14 4:53 Ravikiran G Thirumalai
2004-07-14 4:56 ` [RFC] Lock free fd lookup Ravikiran G Thirumalai
2004-07-14 15:17 ` Chris Wright
2004-07-15 14:22 ` Jesse Barnes
2004-07-15 16:10 ` Dipankar Sarma
2004-07-15 16:22 ` Jesse Barnes
2004-07-15 16:34 ` Chris Wright
2004-07-16 5:38 ` Ravikiran G Thirumalai
2004-07-16 6:27 ` William Lee Irwin III
2004-07-17 0:55 ` Keith Owens
2004-07-17 1:19 ` William Lee Irwin III
2004-07-17 2:12 ` Keith Owens
2004-07-17 2:34 ` William Lee Irwin III
2004-07-17 2:28 ` Keith Owens
2004-07-17 3:16 ` William Lee Irwin III
2004-07-17 13:48 ` Peter Zijlstra
2004-07-14 7:07 ` [RFC] Refcounting of objects part of a lockfree collection Greg KH
2004-07-14 8:26 ` Dipankar Sarma
2004-07-14 14:26 ` Greg KH
2004-07-14 15:22 ` Dipankar Sarma
2004-07-14 17:03 ` Greg KH
2004-07-14 17:49 ` Dipankar Sarma
2004-07-14 18:03 ` Greg KH
2004-07-15 6:21 ` Ravikiran G Thirumalai
2004-07-15 6:56 ` Dipankar Sarma
2004-07-14 8:57 ` Ravikiran G Thirumalai
2004-07-14 17:08 ` Greg KH
2004-07-14 18:17 ` Dipankar Sarma
2004-07-15 8:02 ` Ravikiran G Thirumalai
2004-07-15 9:36 ` Dipankar Sarma
2004-07-16 14:32 ` Greg KH
2004-07-16 15:50 ` Ravikiran G Thirumalai [this message]
2004-07-14 10:24 Oleg Nesterov
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=20040716155049.GC1257@obelix.in.ibm.com \
--to=kiran@in.ibm.com \
--cc=dipankar@in.ibm.com \
--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
all inboxes | Powered by JetHome®