From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: Re: [PATCH 1/1] x86 atomic operations: atomic_or_long atomic_inc_short
Date: Thu, 05 Jun 2008 16:27:00 +0100 [thread overview]
Message-ID: <484805C4.7030809@goop.org> (raw)
In-Reply-To: <E1K3zfZ-0002Bj-8P@eag09.americas.sgi.com>
Cliff Wickman wrote:
> From: Cliff Wickman <cpw@sgi.com>
>
> Provide atomic operations for increment of a 16-bit integer and
> logical OR into a 64-bit integer.
>
> [ This patch was split off of patch:
> SGI UV: TLB shootdown using broadcast assist unit
> and improved with advice from Jeremy Fitzhardinge <jeremy@goop.org> ]
>
> Diffed against 2.6.26-rc4
>
> Signed-off-by: Cliff Wickman <cpw@sgi.com>
>
Reviewed-by: Jeremy Fitzhardinge <jeremy@goop.org>
> ---
> include/asm-x86/atomic_64.h | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> Index: linux/include/asm-x86/atomic_64.h
> ===================================================================
> --- linux.orig/include/asm-x86/atomic_64.h
> +++ linux/include/asm-x86/atomic_64.h
> @@ -431,6 +431,32 @@ static inline int atomic64_add_unless(at
> return c != (u);
> }
>
> +/**
> + * atomic_inc_short - increment of a short integer
> + * @v: pointer to type int
> + *
> + * Atomically adds 1 to @v
> + * Returns the new value of @u
> + */
> +static inline short int atomic_inc_short(short int *v)
> +{
> + asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
> + return *v;
> +}
> +
> +/**
> + * atomic_or_long - OR of two long integers
> + * @v1: pointer to type unsigned long
> + * @v2: pointer to type unsigned long
> + *
> + * Atomically ORs @v1 and @v2
> + * Returns the result of the OR
> + */
> +static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
> +{
> + asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
> +}
> +
> #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
>
> /* These are x86-specific, used by some header files */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2008-06-05 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-04 20:33 [PATCH 1/1] x86 atomic operations: atomic_or_long atomic_inc_short Cliff Wickman
2008-06-05 15:27 ` Jeremy Fitzhardinge [this message]
2008-06-10 10:11 ` Ingo Molnar
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=484805C4.7030809@goop.org \
--to=jeremy@goop.org \
--cc=cpw@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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