diff options
Diffstat (limited to 'include/linux/six.h')
-rw-r--r-- | include/linux/six.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/include/linux/six.h b/include/linux/six.h index 41ddf63b..f336ae04 100644 --- a/include/linux/six.h +++ b/include/linux/six.h @@ -59,7 +59,6 @@ */ #include <linux/lockdep.h> -#include <linux/osq_lock.h> #include <linux/sched.h> #include <linux/types.h> @@ -105,18 +104,23 @@ enum six_lock_type { struct six_lock { union six_lock_state state; - unsigned intent_lock_recurse; struct task_struct *owner; - struct optimistic_spin_queue osq; unsigned __percpu *readers; - + unsigned intent_lock_recurse; raw_spinlock_t wait_lock; - struct list_head wait_list[2]; + struct list_head wait_list; #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif }; +struct six_lock_waiter { + struct list_head list; + struct task_struct *task; + enum six_lock_type lock_want; + bool lock_acquired; +}; + typedef int (*six_lock_should_sleep_fn)(struct six_lock *lock, void *); static __always_inline void __six_lock_init(struct six_lock *lock, @@ -125,8 +129,7 @@ static __always_inline void __six_lock_init(struct six_lock *lock, { atomic64_set(&lock->state.counter, 0); raw_spin_lock_init(&lock->wait_lock); - INIT_LIST_HEAD(&lock->wait_list[SIX_LOCK_read]); - INIT_LIST_HEAD(&lock->wait_list[SIX_LOCK_intent]); + INIT_LIST_HEAD(&lock->wait_list); #ifdef CONFIG_DEBUG_LOCK_ALLOC debug_check_no_locks_freed((void *) lock, sizeof(*lock)); lockdep_init_map(&lock->dep_map, name, key, 0); @@ -146,6 +149,8 @@ do { \ bool six_trylock_##type(struct six_lock *); \ bool six_relock_##type(struct six_lock *, u32); \ int six_lock_##type(struct six_lock *, six_lock_should_sleep_fn, void *);\ +int six_lock_waiter_##type(struct six_lock *, struct six_lock_waiter *, \ + six_lock_should_sleep_fn, void *); \ void six_unlock_##type(struct six_lock *); __SIX_LOCK(read) @@ -182,6 +187,13 @@ static inline int six_lock_type(struct six_lock *lock, enum six_lock_type type, SIX_LOCK_DISPATCH(type, six_lock, lock, should_sleep_fn, p); } +static inline int six_lock_type_waiter(struct six_lock *lock, enum six_lock_type type, + struct six_lock_waiter *wait, + six_lock_should_sleep_fn should_sleep_fn, void *p) +{ + SIX_LOCK_DISPATCH(type, six_lock_waiter, lock, wait, should_sleep_fn, p); +} + static inline void six_unlock_type(struct six_lock *lock, enum six_lock_type type) { SIX_LOCK_DISPATCH(type, six_unlock, lock); @@ -196,13 +208,11 @@ void six_lock_increment(struct six_lock *, enum six_lock_type); void six_lock_wakeup_all(struct six_lock *); -void six_lock_pcpu_free_rcu(struct six_lock *); void six_lock_pcpu_free(struct six_lock *); void six_lock_pcpu_alloc(struct six_lock *); struct six_lock_count { - unsigned read; - unsigned intent; + unsigned n[3]; }; struct six_lock_count six_lock_counts(struct six_lock *); |