public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Dipankar Sarma <dipankar@in.ibm.com>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-arch@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH 1/3][RFC] atomic_cmpxchg, atomic_inc_not_zero
Date: Mon, 12 Sep 2005 21:00:53 +0530	[thread overview]
Message-ID: <20050912153053.GA4778@in.ibm.com> (raw)
In-Reply-To: <432595D5.1090502@yahoo.com.au>

On Tue, Sep 13, 2005 at 12:51:01AM +1000, Nick Piggin wrote:
> The recent file_table RCU work introduced a new rcuref.h thing,
> which is just begging to be atomic.h. Basically it uses atomic_t,
> digs into the atomic_t type, and also defines its own table of
> spinlocks if the arch doesn't have cmpxchg() thus rendering it
> unsafe for any other atomic_xxx operation to be performed on it.

The rcuref_xxx primitives were for only RCU protected refcounters
and I implemented all the primitives needed for them and use
of them was mandatory.

> Anyway, as it turns out, my lockless pagecache patches have the
> exact same requirement, and so I am proposing to implement two
> new atomic_ primitives that should be useful.
> 
> Only one is actually needed, atomic_inc_not_zero being the exact
> fit for both, however I did atomic_cmpxchg first and it can stay
> around because hopefully will be a generally useful primitive.
> 
> Now atomic_inc_not_zero is not really anything to do with RCU other
> than an RCU protected refcounted structure being an obvious user to
> take a reference on the read side where there is nothing to pin it.
> 
> 1/3 is atomic_cmpxchg, not guaranteed to even compile on most.

This is sooo much better. I would much rather kill rcuref.h
and directly use atomic_inc_not_zero() when necessary.
Please feel free to churn out the whole implementation and I will
test it.

Thanks
Dipankar

  parent reply	other threads:[~2005-09-12 15:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 14:51 [PATCH 1/3][RFC] atomic_cmpxchg, atomic_inc_not_zero Nick Piggin
2005-09-12 14:53 ` [PATCH 2/3][RFC] " Nick Piggin
2005-09-12 14:55   ` [PATCH 3/3][RFC] remove rcuref.h Nick Piggin
2005-09-12 15:34     ` Dipankar Sarma
2005-09-12 15:30 ` Dipankar Sarma [this message]
2005-09-12 15:42   ` [PATCH 1/3][RFC] atomic_cmpxchg, atomic_inc_not_zero Nick Piggin
2005-09-12 16:11     ` Ralf Baechle
2005-09-12 20:46     ` David S. Miller

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=20050912153053.GA4778@in.ibm.com \
    --to=dipankar@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=torvalds@osdl.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