[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions |
Date: |
Mon, 1 Dec 2014 13:52:36 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, Nov 27, 2014 at 05:42:41PM +0100, Paolo Bonzini wrote:
>
>
> On 27/11/2014 13:29, Stefan Hajnoczi wrote:
> > +void bitmap_set_atomic(unsigned long *map, long start, long nr)
> > +{
> > + unsigned long *p = map + BIT_WORD(start);
> > + const long size = start + nr;
> > + int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
> > + unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
> > +
> > + while (nr - bits_to_set >= 0) {
> > + atomic_or(p, mask_to_set);
>
> atomic_or is unnecessary while mask_to_set is ~0UL. I think not even a
> smp_wmb() is necessary.
Okay, I can split this into the ~0UL case and the atomic case.
pgpJzapNRSBeH.pgp
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [RFC 1/6] bitmap: add atomic set functions,
Stefan Hajnoczi <=