Lines Matching refs:count
83 sem->count = RWSEM_UNLOCKED_VALUE; in __init_rwsem()
216 long count, adjustment = -RWSEM_ACTIVE_READ_BIAS; in rwsem_down_read_failed() local
231 count = rwsem_atomic_update(adjustment, sem); in rwsem_down_read_failed()
238 if (count == RWSEM_WAITING_BIAS || in rwsem_down_read_failed()
239 (count > RWSEM_WAITING_BIAS && in rwsem_down_read_failed()
258 static inline bool rwsem_try_write_lock(long count, struct rw_semaphore *sem) in rwsem_try_write_lock() argument
264 if (count == RWSEM_WAITING_BIAS && in rwsem_try_write_lock()
265 cmpxchg_acquire(&sem->count, RWSEM_WAITING_BIAS, in rwsem_try_write_lock()
282 long old, count = READ_ONCE(sem->count); in rwsem_try_write_lock_unqueued() local
285 if (!(count == 0 || count == RWSEM_WAITING_BIAS)) in rwsem_try_write_lock_unqueued()
288 old = cmpxchg_acquire(&sem->count, count, in rwsem_try_write_lock_unqueued()
289 count + RWSEM_ACTIVE_WRITE_BIAS); in rwsem_try_write_lock_unqueued()
290 if (old == count) { in rwsem_try_write_lock_unqueued()
295 count = old; in rwsem_try_write_lock_unqueued()
310 long count = READ_ONCE(sem->count); in rwsem_can_spin_on_owner() local
317 if (count & RWSEM_ACTIVE_MASK) in rwsem_can_spin_on_owner()
331 long count; in rwsem_spin_on_owner() local
361 count = READ_ONCE(sem->count); in rwsem_spin_on_owner()
362 return (count == 0 || count == RWSEM_WAITING_BIAS); in rwsem_spin_on_owner()
439 long count; in rwsem_down_write_failed() local
444 count = rwsem_atomic_update(-RWSEM_ACTIVE_WRITE_BIAS, sem); in rwsem_down_write_failed()
467 count = READ_ONCE(sem->count); in rwsem_down_write_failed()
474 if (count > RWSEM_WAITING_BIAS) in rwsem_down_write_failed()
478 count = rwsem_atomic_update(RWSEM_WAITING_BIAS, sem); in rwsem_down_write_failed()
483 if (rwsem_try_write_lock(count, sem)) in rwsem_down_write_failed()
491 } while ((count = sem->count) & RWSEM_ACTIVE_MASK); in rwsem_down_write_failed()