search for: atomic_clear_bit

Displaying 10 results from an estimated 10 matches for "atomic_clear_bit".

2019 Aug 07
2
[PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker
...map = vq->maps[VHOST_ADDR_USED]; Still needs a read side barrier, and then I think this will be no better than a normal spinlock. It also doesn't seem like this algorithm even needs a seqlock, as this is just a one bit flag atomic_set_bit(using map) smp_mb__after_atomic() .. maps [...] atomic_clear_bit(using map) map = NULL; smp_mb__before_atomic(); while (atomic_read_bit(using map)) relax() Again, not clear this could be faster than a spinlock when the barriers are correct... Jason
2019 Aug 07
2
[PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker
...map = vq->maps[VHOST_ADDR_USED]; Still needs a read side barrier, and then I think this will be no better than a normal spinlock. It also doesn't seem like this algorithm even needs a seqlock, as this is just a one bit flag atomic_set_bit(using map) smp_mb__after_atomic() .. maps [...] atomic_clear_bit(using map) map = NULL; smp_mb__before_atomic(); while (atomic_read_bit(using map)) relax() Again, not clear this could be faster than a spinlock when the barriers are correct... Jason
2019 Aug 08
3
[PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker
...t also doesn't seem like this algorithm even needs a seqlock, as this >> is just a one bit flag > > > Right, so then I tend to use spinlock first for correctness. > > >> >> atomic_set_bit(using map) >> smp_mb__after_atomic() >> .. maps [...] >> atomic_clear_bit(using map) >> >> >> map = NULL; >> smp_mb__before_atomic(); >> while (atomic_read_bit(using map)) >> ??? relax() >> >> Again, not clear this could be faster than a spinlock when the >> barriers are correct... > I've done some benchmark[1...
2019 Aug 07
0
[PATCH V4 7/9] vhost: do not use RCU to synchronize MMU notifier with worker
...t; better than a normal spinlock. > > It also doesn't seem like this algorithm even needs a seqlock, as this > is just a one bit flag Right, so then I tend to use spinlock first for correctness. > > atomic_set_bit(using map) > smp_mb__after_atomic() > .. maps [...] > atomic_clear_bit(using map) > > > map = NULL; > smp_mb__before_atomic(); > while (atomic_read_bit(using map)) > relax() > > Again, not clear this could be faster than a spinlock when the > barriers are correct... Yes, for next release we may want to use the idea from Michael like to...
2014 Mar 03
5
[PATCH v5 3/8] qspinlock, x86: Add x86 specific optimization for 2 contending tasks
...KED; old = atomic_cmpxchg(&lock->val, val, new); if (old == val) break; val = old; } #else ((u8 *)lock)[0] = 1; /* locked */ smp_wmb(); ((u8 *)lock)[1] = 0; /* pending */ // there is a big difference between an atomic and // no atomic op. // // smp_mb__before_atomic_inc(); // atomic_clear_bit(_Q_PENDING_OFFSET, &lock->val); #endif return; queue: #endif node = this_cpu_ptr(&mcs_nodes[0]); idx = node->count++; code = encode_tail(smp_processor_id(), idx); node += idx; node->locked = 0; node->next = NULL; /* * we already touched the queueing cacheline; don&...
2014 Mar 03
5
[PATCH v5 3/8] qspinlock, x86: Add x86 specific optimization for 2 contending tasks
...KED; old = atomic_cmpxchg(&lock->val, val, new); if (old == val) break; val = old; } #else ((u8 *)lock)[0] = 1; /* locked */ smp_wmb(); ((u8 *)lock)[1] = 0; /* pending */ // there is a big difference between an atomic and // no atomic op. // // smp_mb__before_atomic_inc(); // atomic_clear_bit(_Q_PENDING_OFFSET, &lock->val); #endif return; queue: #endif node = this_cpu_ptr(&mcs_nodes[0]); idx = node->count++; code = encode_tail(smp_processor_id(), idx); node += idx; node->locked = 0; node->next = NULL; /* * we already touched the queueing cacheline; don&...
2014 Feb 28
5
[PATCH v5 3/8] qspinlock, x86: Add x86 specific optimization for 2 contending tasks
On Thu, Feb 27, 2014 at 03:42:19PM -0500, Waiman Long wrote: > >>+ old = xchg(&qlock->lock_wait, _QSPINLOCK_WAITING|_QSPINLOCK_LOCKED); > >>+ > >>+ if (old == 0) { > >>+ /* > >>+ * Got the lock, can clear the waiting bit now > >>+ */ > >>+ smp_u8_store_release(&qlock->wait, 0); > > > >So we just did an
2014 Feb 28
5
[PATCH v5 3/8] qspinlock, x86: Add x86 specific optimization for 2 contending tasks
On Thu, Feb 27, 2014 at 03:42:19PM -0500, Waiman Long wrote: > >>+ old = xchg(&qlock->lock_wait, _QSPINLOCK_WAITING|_QSPINLOCK_LOCKED); > >>+ > >>+ if (old == 0) { > >>+ /* > >>+ * Got the lock, can clear the waiting bit now > >>+ */ > >>+ smp_u8_store_release(&qlock->wait, 0); > > > >So we just did an
2019 Aug 07
12
[PATCH V4 0/9] Fixes for metadata accelreation
Hi all: This series try to fix several issues introduced by meta data accelreation series. Please review. Changes from V3: - remove the unnecessary patch Changes from V2: - use seqlck helper to synchronize MMU notifier with vhost worker Changes from V1: - try not use RCU to syncrhonize MMU notifier with vhost worker - set dirty pages after no readers - return -EAGAIN only when we find the
2019 Aug 07
12
[PATCH V4 0/9] Fixes for metadata accelreation
Hi all: This series try to fix several issues introduced by meta data accelreation series. Please review. Changes from V3: - remove the unnecessary patch Changes from V2: - use seqlck helper to synchronize MMU notifier with vhost worker Changes from V1: - try not use RCU to syncrhonize MMU notifier with vhost worker - set dirty pages after no readers - return -EAGAIN only when we find the