From: Greg KH <greg@kroah.com>
To: Karim Yaghmour <karim@opersys.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
LTT-Dev <ltt-dev@shafik.org>
Subject: Re: [PATCH 3/4] relayfs for 2.6.10: locking/lockless implementation
Date: Fri, 14 Jan 2005 11:17:07 -0800 [thread overview]
Message-ID: <20050114191707.GC15337@kroah.com> (raw)
In-Reply-To: <41E736C1.5060104@opersys.com>
On Thu, Jan 13, 2005 at 10:04:33PM -0500, Karim Yaghmour wrote:
> +/**
> + * compare_and_store_volatile - self-explicit
> + * @ptr: ptr to the word that will receive the new value
> + * @oval: the value we think is currently in *ptr
> + * @nval: the value *ptr will get if we were right
> + */
> +inline int
> +compare_and_store_volatile(volatile u32 *ptr,
> + u32 oval,
> + u32 nval)
> +{
> + u32 prev;
> +
> + barrier();
> + prev = cmpxchg(ptr, oval, nval);
> + barrier();
> +
> + return (prev == oval);
> +}
Why is this function needed? What's wrong with the "normal" cmpxchg?
> +/**
> + * atomic_set_volatile - atomically set the value in ptr to nval.
> + * @ptr: ptr to the word that will receive the new value
> + * @nval: the new value
> + */
> +inline void
> +atomic_set_volatile(atomic_t *ptr,
> + u32 nval)
> +{
> + barrier();
> + atomic_set(ptr, (int)nval);
> + barrier();
> +}
Same here, what's wrong with the normal atomic_set()?
Same question also goes for the other functions like this in this file.
thanks,
greg k-h
next prev parent reply other threads:[~2005-01-14 19:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-14 3:04 [PATCH 3/4] relayfs for 2.6.10: locking/lockless implementation Karim Yaghmour
2005-01-14 19:17 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-01-14 22:57 Robert Wisniewski
2005-01-14 23:48 ` Greg KH
2005-01-15 1:30 ` Robert Wisniewski
2005-01-19 19:25 ` Greg KH
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=20050114191707.GC15337@kroah.com \
--to=greg@kroah.com \
--cc=karim@opersys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@shafik.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