Home
last modified time | relevance | path

Searched full:lock (Results 1 – 25 of 3404) sorted by relevance

12345678910>>...137

/linux/include/linux/
H A Dspinlock.h73 #define LOCK_SECTION_NAME ".text..lock."KBUILD_BASENAME
102 extern void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
105 # define raw_spin_lock_init(lock) \ argument
109 __raw_spin_lock_init((lock), #lock, &__key, LD_WAIT_SPIN); \
113 # define raw_spin_lock_init(lock) \ argument
114 do { *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); } while (0)
117 #define raw_spin_is_locked(lock) arch_spin_is_locked(&(lock)->raw_lock) argument
120 #define raw_spin_is_contended(lock) arch_spin_is_contended(&(lock)->raw_lock) argument
122 #define raw_spin_is_contended(lock) (((void)(lock), 0)) argument
127 * between program-order earlier lock acquisitions and program-order later
[all …]
H A Dlocal_lock_internal.h81 #define __local_lock_init(lock) \ argument
85 debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
86 lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
89 local_lock_debug_init(lock); \
92 #define __local_trylock_init(lock) \ argument
94 __local_lock_init((local_lock_t *)lock); \
97 #define __spinlock_nested_bh_init(lock) \ argument
101 debug_check_no_locks_freed((void *)lock, sizeof(*lock));\
102 lockdep_init_map_type(&(lock)->dep_map, #lock, &__key, \
105 local_lock_debug_init(lock); \
[all …]
/linux/fs/ocfs2/dlm/
H A Ddlmast.c35 struct dlm_lock *lock);
36 static int dlm_should_cancel_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock);
39 * lock level will obsolete a pending bast.
40 * For example, if dlm_thread queued a bast for an EX lock that
42 * lock owner downconverted to NL, the bast is now obsolete.
44 * This is needed because the lock and convert paths can queue
47 static int dlm_should_cancel_bast(struct dlm_ctxt *dlm, struct dlm_lock *lock) in dlm_should_cancel_bast() argument
50 assert_spin_locked(&lock->spinlock); in dlm_should_cancel_bast()
52 if (lock->ml.highest_blocked == LKM_IVMODE) in dlm_should_cancel_bast()
54 BUG_ON(lock->ml.highest_blocked == LKM_NLMODE); in dlm_should_cancel_bast()
[all …]
H A Ddlmlock.c5 * underlying calls for lock creation
45 struct dlm_lock *lock, int flags);
49 static void dlm_lock_detach_lockres(struct dlm_lock *lock);
66 /* Tell us whether we can grant a new lock request.
71 * returns: 1 if the lock can be granted, 0 otherwise.
74 struct dlm_lock *lock) in dlm_can_grant_new_lock() argument
79 if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type)) in dlm_can_grant_new_lock()
84 if (!dlm_lock_compatible(tmplock->ml.type, lock->ml.type)) in dlm_can_grant_new_lock()
87 lock->ml.type)) in dlm_can_grant_new_lock()
94 /* performs lock creation at the lockres master site
[all …]
H A Ddlmconvert.c5 * underlying calls for lock conversion
38 * only one that holds a lock on exit (res->spinlock).
43 struct dlm_lock *lock, int flags,
48 struct dlm_lock *lock, int flags, int type);
61 struct dlm_lock *lock, int flags, int type) in dlmconvert_master() argument
72 status = __dlmconvert_master(dlm, res, lock, flags, type, in dlmconvert_master()
83 dlm_queue_ast(dlm, lock); in dlmconvert_master()
93 /* performs lock conversion at the lockres master site
96 * taken: takes and drops lock->spinlock
99 * call_ast: whether ast should be called for this lock
[all …]
H A Ddlmunlock.c43 struct dlm_lock *lock,
48 struct dlm_lock *lock,
54 struct dlm_lock *lock,
67 * So to unlock a converting lock, you must first cancel the
76 * taken: res->spinlock and lock->spinlock taken and dropped
79 * all callers should have taken an extra ref on lock coming in
83 struct dlm_lock *lock, in dlmunlock_common() argument
103 /* We want to be sure that we're not freeing a lock in dlmunlock_common()
105 in_use = !list_empty(&lock->ast_list); in dlmunlock_common()
125 spin_lock(&lock->spinlock); in dlmunlock_common()
[all …]
/linux/drivers/md/persistent-data/
H A Ddm-block-manager.c32 * trace is also emitted for the previous lock acquisition.
45 spinlock_t lock; member
61 static unsigned int __find_holder(struct block_lock *lock, in __find_holder() argument
67 if (lock->holders[i] == task) in __find_holder()
74 /* call this *after* you increment lock->count */
75 static void __add_holder(struct block_lock *lock, struct task_struct *task) in __add_holder() argument
77 unsigned int h = __find_holder(lock, NULL); in __add_holder()
83 lock->holders[h] = task; in __add_holder()
86 t = lock->traces + h; in __add_holder()
91 /* call this *before* you decrement lock->count */
[all …]
/linux/include/asm-generic/
H A Dqrwlock.h3 * Queue read/write lock
28 #define _QW_LOCKED 0x0ff /* A writer holds the lock */
36 extern void queued_read_lock_slowpath(struct qrwlock *lock);
37 extern void queued_write_lock_slowpath(struct qrwlock *lock);
40 * queued_read_trylock - try to acquire read lock of a queued rwlock
41 * @lock : Pointer to queued rwlock structure
42 * Return: 1 if lock acquired, 0 if failed
44 static inline int queued_read_trylock(struct qrwlock *lock) in queued_read_trylock() argument
48 cnts = atomic_read(&lock->cnts); in queued_read_trylock()
50 cnts = (u32)atomic_add_return_acquire(_QR_BIAS, &lock->cnts); in queued_read_trylock()
[all …]
/linux/rust/kernel/sync/
H A Dlock.rs3 //! Generic kernel lock and guard.
5 //! It contains a generic Rust lock and guard that allow for different backends (e.g., mutexes,
22 /// The "backend" of a lock.
24 /// It is the actual implementation of the lock, without the need to repeat patterns used in all
29 /// - Implementers must ensure that only one thread/CPU may access the protected data once the lock
30 /// is owned, that is, between calls to [`lock`] and [`unlock`].
32 /// lock operation.
34 /// [`lock`]: Backend::lock
38 /// The state required by the lock
65 unsafe fn lock(ptr: *mut Self::State) -> Self::GuardState; lock() method
106 pub struct Lock<T: ?Sized, B: Backend> { global() struct
122 dataLock global() argument
123 unsafe impl<T: ?Sized + Send, B: Backend> Send for Lock<T, B> {} global() implementation
127 unsafe impl<T: ?Sized + Send, B: Backend> Sync for Lock<T, B> {} global() implementation
129 impl<T, B: Backend> Lock<T, B> { global() implementation
148 impl<B: Backend> Lock<(), B> { global() implementation
170 impl<T: ?Sized, B: Backend> Lock<T, B> { global() implementation
172 pub fn lock(&self) -> Guard<'_, T, B> { lock() method
199 pub(crate) lock: &'a Lock<T, B>, global() field
[all...]
/linux/Documentation/locking/
H A Dlockdep-design.rst8 Lock-class
15 tens of thousands of) instantiations. For example a lock in the inode
17 lock class.
19 The validator tracks the 'usage state' of lock-classes, and it tracks
20 the dependencies between different lock-classes. Lock usage indicates
21 how a lock is used with regard to its IRQ contexts, while lock
22 dependency can be understood as lock order, where L1 -> L2 suggests that
26 continuing effort to prove lock usages and dependencies are correct or
29 A lock-class's behavior is constructed by its instances collectively:
30 when the first instance of a lock-class is used after bootup the class
[all …]
/linux/arch/powerpc/include/asm/
H A Dsimple_spinlock.h6 * Simple spin lock operations.
35 static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) in arch_spin_value_unlocked() argument
37 return lock.slock == 0; in arch_spin_value_unlocked()
40 static inline int arch_spin_is_locked(arch_spinlock_t *lock) in arch_spin_is_locked() argument
42 return !arch_spin_value_unlocked(READ_ONCE(*lock)); in arch_spin_is_locked()
46 * This returns the old value in the lock, so we succeeded
47 * in getting the lock if the return value is 0.
49 static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock) in __arch_spin_trylock() argument
64 : "r" (token), "r" (&lock->slock), [eh] "n" (eh) in __arch_spin_trylock()
70 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
[all …]
/linux/kernel/locking/
H A Dqrwlock.c15 #include <trace/events/lock.h>
18 * queued_read_lock_slowpath - acquire read lock of a queued rwlock
19 * @lock: Pointer to queued rwlock structure
21 void __lockfunc queued_read_lock_slowpath(struct qrwlock *lock) in queued_read_lock_slowpath() argument
24 * Readers come here when they cannot get the lock without waiting in queued_read_lock_slowpath()
28 * Readers in interrupt context will get the lock immediately in queued_read_lock_slowpath()
29 * if the writer is just waiting (not holding the lock yet), in queued_read_lock_slowpath()
30 * so spin with ACQUIRE semantics until the lock is available in queued_read_lock_slowpath()
33 atomic_cond_read_acquire(&lock->cnts, !(VAL & _QW_LOCKED)); in queued_read_lock_slowpath()
36 atomic_sub(_QR_BIAS, &lock->cnts); in queued_read_lock_slowpath()
[all …]
H A Dqspinlock_paravirt.h30 * not running. The one lock stealing attempt allowed at slowpath entry
57 * Hybrid PV queued/unfair lock
60 * it will be called once when a lock waiter enter the PV slowpath before
64 * pv_wait_head_or_lock() to signal that it is ready to spin on the lock.
65 * When that bit becomes visible to the incoming waiters, no lock stealing
67 * enter the MCS wait queue. So lock starvation shouldn't happen as long
69 * and hence disabling lock stealing.
71 * When the pending bit isn't set, the lock waiters will stay in the unfair
72 * mode spinning on the lock unless the MCS wait queue is empty. In this
73 * case, the lock waiters will enter the queued mode slowpath trying to
[all …]
H A Dqspinlock.c25 #include <trace/events/lock.h>
36 * MCS lock. A copy of the original MCS lock paper ("Algorithms for Scalable
42 * This queued spinlock implementation is based on the MCS lock, however to
46 * In particular; where the traditional MCS lock consists of a tail pointer
55 * number. With one byte for the lock value and 3 bytes for the tail, only a
56 * 32-bit word is now needed. Even though we only need 1 bit for the lock,
60 * We also change the first spinner to spin on the lock bit instead of its
61 * node; whereby avoiding the need to carry a node from lock to unlock, and
62 * preserving existing lock AP
149 clear_pending(struct qspinlock * lock) clear_pending() argument
162 clear_pending_set_locked(struct qspinlock * lock) clear_pending_set_locked() argument
177 xchg_tail(struct qspinlock * lock,u32 tail) xchg_tail() argument
195 clear_pending(struct qspinlock * lock) clear_pending() argument
206 clear_pending_set_locked(struct qspinlock * lock) clear_pending_set_locked() argument
221 xchg_tail(struct qspinlock * lock,u32 tail) xchg_tail() argument
247 queued_fetch_set_pending_acquire(struct qspinlock * lock) queued_fetch_set_pending_acquire() argument
259 set_locked(struct qspinlock * lock) set_locked() argument
273 __pv_kick_node(struct qspinlock * lock,struct mcs_spinlock * node) __pv_kick_node() argument
275 __pv_wait_head_or_lock(struct qspinlock * lock,struct mcs_spinlock * node) __pv_wait_head_or_lock() argument
313 queued_spin_lock_slowpath(struct qspinlock * lock,u32 val) queued_spin_lock_slowpath() argument
[all...]
H A Dmcs_spinlock.h3 * MCS lock defines
5 * This file contains the main data structure and API definitions of MCS lock.
7 * The MCS lock (proposed by Mellor-Crummey and Scott) is a simple spin-lock
9 * to acquire the lock spinning on a local variable.
10 * It avoids expensive cache bounces that common test-and-set spin-lock
22 * lock is acquired. Additionally, some architectures such as
50 * In order to acquire the lock, the caller should declare a local node and
51 * pass a reference of the node to this function in addition to the lock.
52 * If the lock ha
65 mcs_spin_lock(struct mcs_spinlock ** lock,struct mcs_spinlock * node) mcs_spin_lock() argument
102 mcs_spin_unlock(struct mcs_spinlock ** lock,struct mcs_spinlock * node) mcs_spin_unlock() argument
[all...]
/linux/tools/testing/selftests/bpf/progs/
H A Dlinked_list.c12 struct bpf_spin_lock lock; member
28 int list_push_pop(struct bpf_spin_lock *lock, struct bpf_list_head *head, bool leave_in_map) in list_push_pop() argument
37 bpf_spin_lock(lock); in list_push_pop()
39 bpf_spin_unlock(lock); in list_push_pop()
46 bpf_spin_lock(lock); in list_push_pop()
48 bpf_spin_unlock(lock); in list_push_pop()
56 bpf_spin_lock(lock); in list_push_pop()
59 bpf_spin_unlock(lock); in list_push_pop()
62 bpf_spin_lock(lock); in list_push_pop()
64 bpf_spin_unlock(lock); in list_push_pop()
109 list_push_pop_multiple(struct bpf_spin_lock * lock,struct bpf_list_head * head,bool leave_in_map) list_push_pop_multiple() argument
191 list_in_list(struct bpf_spin_lock * lock,struct bpf_list_head * head,bool leave_in_map) list_in_list() argument
261 test_list_push_pop(struct bpf_spin_lock * lock,struct bpf_list_head * head) test_list_push_pop() argument
272 test_list_push_pop_multiple(struct bpf_spin_lock * lock,struct bpf_list_head * head) test_list_push_pop_multiple() argument
283 test_list_in_list(struct bpf_spin_lock * lock,struct bpf_list_head * head) test_list_in_list() argument
[all...]
/linux/arch/alpha/include/asm/
H A Dspinlock.h11 * Simple spin lock operations. There are two variants, one clears IRQ's
17 #define arch_spin_is_locked(x) ((x)->lock != 0)
19 static inline int arch_spin_value_unlocked(arch_spinlock_t lock) in arch_spin_value_unlocked() argument
21 return lock.lock == 0; in arch_spin_value_unlocked()
24 static inline void arch_spin_unlock(arch_spinlock_t * lock) in arch_spin_unlock() argument
27 lock->lock = 0; in arch_spin_unlock()
30 static inline void arch_spin_lock(arch_spinlock_t * lock) in arch_spin_lock() argument
46 : "=&r" (tmp), "=m" (lock->lock) in arch_spin_lock()
47 : "m"(lock->lock) : "memory"); in arch_spin_lock()
50 static inline int arch_spin_trylock(arch_spinlock_t *lock) in arch_spin_trylock() argument
[all …]
/linux/tools/perf/tests/shell/
H A Dlock_contention.sh2 # kernel lock contention analysis test
12 # Workload to generate lock contention.
13 # Using 1 group (-g 1) keeps runtime low while generating sufficient lock events.
14 # We include -p (pipes) because socketpairs don't generate enough lock events on s390.
41 if ! perf list tracepoint | grep -q lock:contention_begin; then
42 echo "[Skip] No lock contention tracepoints"
49 echo "[Skip] Low number of CPUs (`nproc`), lock event cannot be triggered certainly"
57 echo "Testing perf lock record and perf lock contention"
58 perf lock recor
[all...]
/linux/arch/hexagon/include/asm/
H A Dspinlock.h22 * - load the lock value
24 * - if the lock value is still negative, go back and try again.
26 * - successful store new lock value if positive -> lock acquired
28 static inline void arch_read_lock(arch_rwlock_t *lock) in arch_read_lock() argument
37 : "r" (&lock->lock) in arch_read_lock()
43 static inline void arch_read_unlock(arch_rwlock_t *lock) in arch_read_unlock() argument
51 : "r" (&lock->lock) in arch_read_unlock()
58 static inline int arch_read_trylock(arch_rwlock_t *lock) in arch_read_trylock() argument
69 : "r" (&lock->lock) in arch_read_trylock()
75 /* Stuffs a -1 in the lock value? */
[all …]
/linux/tools/perf/Documentation/
H A Dperf-lock.txt1 perf-lock(1)
6 perf-lock - Analyze lock events
11 'perf lock' {record|report|script|info|contention}
15 You can analyze various lock behaviours
16 and statistics with this 'perf lock' command.
18 'perf lock record <command>' records lock events
21 results of lock events.
23 'perf lock report' reports statistical data.
25 'perf lock script' shows raw lock events.
27 'perf lock info' shows metadata like threads or addresses
[all …]
/linux/arch/mips/include/asm/octeon/
H A Dcvmx-spinlock.h61 * @lock: Lock to initialize
63 static inline void cvmx_spinlock_init(cvmx_spinlock_t *lock) in cvmx_spinlock_init() argument
65 lock->value = CVMX_SPINLOCK_UNLOCKED_VAL; in cvmx_spinlock_init()
71 * @lock: Lock to check
74 static inline int cvmx_spinlock_locked(cvmx_spinlock_t *lock) in cvmx_spinlock_locked() argument
76 return lock->value != CVMX_SPINLOCK_UNLOCKED_VAL; in cvmx_spinlock_locked()
80 * Releases lock
82 * @lock: pointer to lock structure
84 static inline void cvmx_spinlock_unlock(cvmx_spinlock_t *lock) in cvmx_spinlock_unlock() argument
87 lock->value = 0; in cvmx_spinlock_unlock()
[all …]
/linux/fs/btrfs/
H A Dlocking.h31 * When we COW a block we are holding the lock on the original block,
33 * when we lock the newly allocated COW'd block. Handle this by having
39 * Oftentimes we need to lock adjacent nodes on the same level while
40 * still holding the lock on the original node we searched to, such as
51 * When splitting we will be holding a lock on the left/right node when
97 * @lock: The lockdep map corresponding to a wait event
100 * the lockdep map as writer (exclusive lock) because it has to block until all
101 * the threads that hold the lock as readers signal the condition for the wait
104 #define btrfs_might_wait_for_event(owner, lock) \ argument
106 rwsem_acquire(&owner->lock##_map, 0, 0, _THIS_IP_); \
[all …]
/linux/fs/lockd/
H A Dsvclock.c40 static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct lockd_lock *lock);
51 * Insert a blocked lock into the global list
108 * Find a block for a given lock
111 nlmsvc_lookup_block(struct nlm_file *file, struct lockd_lock *lock) in nlmsvc_lookup_block() argument
117 file, lock->fl.c.flc_pid, in nlmsvc_lookup_block()
118 (long long)lock->fl.fl_start, in nlmsvc_lookup_block()
119 (long long)lock->fl.fl_end, in nlmsvc_lookup_block()
120 lock->fl.c.flc_type); in nlmsvc_lookup_block()
123 fl = &block->b_call->a_args.lock.fl; in nlmsvc_lookup_block()
130 if (block->b_file == file && nlm_compare_locks(fl, &lock->fl)) { in nlmsvc_lookup_block()
[all …]
/linux/tools/virtio/linux/
H A Dspinlock.h8 static inline void spin_lock_init(spinlock_t *lock) in spin_lock_init() argument
10 int r = pthread_spin_init(lock, 0); in spin_lock_init()
14 static inline void spin_lock(spinlock_t *lock) in spin_lock() argument
16 int ret = pthread_spin_lock(lock); in spin_lock()
20 static inline void spin_unlock(spinlock_t *lock) in spin_unlock() argument
22 int ret = pthread_spin_unlock(lock); in spin_unlock()
26 static inline void spin_lock_bh(spinlock_t *lock) in spin_lock_bh() argument
28 spin_lock(lock); in spin_lock_bh()
31 static inline void spin_unlock_bh(spinlock_t *lock) in spin_unlock_bh() argument
33 spin_unlock(lock); in spin_unlock_bh()
[all …]
/linux/lib/
H A Datomic64.c25 * Ensure each lock is in a separate cacheline.
28 arch_spinlock_t lock; member
32 .lock = __ARCH_SPIN_LOCK_UNLOCKED,
42 return &atomic64_lock[addr & (NR_LOCKS - 1)].lock; in lock_addr()
48 arch_spinlock_t *lock = lock_addr(v); in generic_atomic64_read() local
52 arch_spin_lock(lock); in generic_atomic64_read()
54 arch_spin_unlock(lock); in generic_atomic64_read()
63 arch_spinlock_t *lock = lock_addr(v); in generic_atomic64_set() local
66 arch_spin_lock(lock); in generic_atomic64_set()
68 arch_spin_unlock(lock); in generic_atomic64_set()
[all …]

12345678910>>...137