/* SPDX-License-Identifier: GPL-2.0 */ /* * The owner field of the rw_semaphore structure will be set to * RWSEM_READ_OWNED when a reader grabs the lock. A writer will clear * the owner field when it unlocks. A reader, on the other hand, will * not touch the owner field when it unlocks. * * In essence, the owner field now has the following 3 states: * 1) 0 * - lock is free or the owner hasn't set the field yet * 2) RWSEM_READER_OWNED * - lock is currently or previously owned by readers (lock is free * or not set by owner yet) * 3) Other non-zero value * - a writer owns the lock */ #define RWSEM_READER_OWNED ((struct task_struct *)1UL) #ifdef CONFIG_RWSEM_SPIN_ON_OWNER /* * All writes to owner are protected by WRITE_ONCE() to make sure that * store tearing can't happen as optimistic spinners may read and use * the owner value concurrently without lock. Read from owner, however, * may not need READ_ONCE() as long as the pointer value is only used * for comparison and isn't being dereferenced. */
static inline void rwsem_set_owner(struct rw_semaphore *sem) { WRITE_ONCE(sem->owner, current); }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Davidlohr Bueso A | 17 | 80.95% | 1 | 50.00% |
Waiman Long | 4 | 19.05% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Davidlohr Bueso A | 17 | 80.95% | 1 | 50.00% |
Waiman Long | 4 | 19.05% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Waiman Long | 30 | 100.00% | 2 | 100.00% |
Total | 30 | 100.00% | 2 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Waiman Long | 19 | 100.00% | 1 | 100.00% |
Total | 19 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Waiman Long | 17 | 100.00% | 1 | 100.00% |
Total | 17 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Davidlohr Bueso A | 11 | 100.00% | 1 | 100.00% |
Total | 11 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Davidlohr Bueso A | 11 | 100.00% | 1 | 100.00% |
Total | 11 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Waiman Long | 11 | 100.00% | 1 | 100.00% |
Total | 11 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Waiman Long | 91 | 58.71% | 2 | 50.00% |
Davidlohr Bueso A | 63 | 40.65% | 1 | 25.00% |
Greg Kroah-Hartman | 1 | 0.65% | 1 | 25.00% |
Total | 155 | 100.00% | 4 | 100.00% |