From: Rob Landley <rob@landley.net>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] bitops: add _local bitops
Date: Thu, 10 May 2012 12:38:06 -0500 [thread overview]
Message-ID: <4FABFCFE.8010307@landley.net> (raw)
In-Reply-To: <20120509134528.GA18044@redhat.com>
On 05/09/2012 08:45 AM, Michael S. Tsirkin wrote:
> diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
> index 27f2b21..b7e3b67 100644
> --- a/Documentation/atomic_ops.txt
> +++ b/Documentation/atomic_ops.txt
> @@ -520,6 +520,25 @@ The __clear_bit_unlock version is non-atomic, however it still implements
> unlock barrier semantics. This can be useful if the lock itself is protecting
> the other bits in the word.
>
> +Local versions of the bitmask operations are also provided. They are used in
> +contexts where the operations need to be performed atomically with respect to
> +the local CPU, but no other CPU accesses the bitmask. This assumption makes it
> +possible to avoid the need for SMP protection and use less expensive atomic
> +operations in the implementation.
> +They have names similar to the above bitmask operation interfaces,
> +except that _local is sufficed to the interface name.
> +
> + void set_bit_local(unsigned long nr, volatile unsigned long *addr);
> + void clear_bit_local(unsigned long nr, volatile unsigned long *addr);
> + void change_bit_local(unsigned long nr, volatile unsigned long *addr);
> + int test_and_set_bit_local(unsigned long nr, volatile unsigned long *addr);
> + int test_and_clear_bit_local(unsigned long nr, volatile unsigned long *addr);
> + int test_and_change_bit_local(unsigned long nr, volatile unsigned long *addr);
> +
> +These local variants are useful for example if the bitmask may be accessed from
> +a local intrerrupt, or from a hypervisor on the same CPU if running in a VM.
> +These local variants also do not have any special memory barrier semantics.
> +
> Finally, there are non-atomic versions of the bitmask operations
> provided. They are used in contexts where some other higher-level SMP
> locking scheme is being used to protect the bitmask, and thus less
For this bit:
Acked-by: Rob Landley <rob@landley.net>
Rob
--
GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code.
Either it's "mere aggregation", or a license violation. Pick one.
next prev parent reply other threads:[~2012-05-10 17:38 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 13:45 [PATCH] bitops: add _local bitops Michael S. Tsirkin
2012-05-09 13:45 ` Michael S. Tsirkin
2012-05-09 14:03 ` H. Peter Anvin
2012-05-09 14:03 ` H. Peter Anvin
2012-05-09 15:06 ` Michael S. Tsirkin
2012-05-09 15:06 ` Michael S. Tsirkin
2012-05-09 15:43 ` Michael S. Tsirkin
2012-05-09 15:43 ` Michael S. Tsirkin
2012-05-09 15:44 ` H. Peter Anvin
2012-05-09 15:44 ` H. Peter Anvin
2012-05-09 15:47 ` Michael S. Tsirkin
2012-05-09 15:47 ` Michael S. Tsirkin
2012-05-09 16:24 ` H. Peter Anvin
2012-05-09 16:24 ` H. Peter Anvin
2012-05-09 16:36 ` Michael S. Tsirkin
2012-05-09 16:45 ` H. Peter Anvin
2012-05-09 16:45 ` H. Peter Anvin
2012-05-09 16:55 ` Michael S. Tsirkin
2012-05-09 16:55 ` Michael S. Tsirkin
2012-05-09 14:06 ` Arnd Bergmann
2012-05-09 14:06 ` Arnd Bergmann
2012-05-09 14:17 ` Avi Kivity
2012-05-09 19:19 ` Andrew Morton
2012-05-09 19:23 ` H. Peter Anvin
2012-05-09 19:23 ` H. Peter Anvin
2012-05-09 20:07 ` Michael S. Tsirkin
2012-05-09 20:10 ` H. Peter Anvin
2012-05-09 20:10 ` H. Peter Anvin
2012-05-09 20:12 ` Michael S. Tsirkin
2012-05-09 20:12 ` Michael S. Tsirkin
2012-05-10 9:26 ` Avi Kivity
2012-05-10 23:02 ` Benjamin Herrenschmidt
2012-05-10 17:38 ` Rob Landley [this message]
2012-05-10 17:38 ` Rob Landley
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=4FABFCFE.8010307@landley.net \
--to=rob@landley.net \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
/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