locking: Add __percpu tag to decode_tail qnode argument
Subsystems (2)
Kumar Kartikeya Dwivedi
maintainerPATCH 1/1 locking: Add __percpu tag to decode_tail qnode argument
The decode_tail function now takes a qnode argument to use distinct qnodes for qspinlock and rqspinlock. Add a __percpu tag to avoid warnings and errors and reflect that the qnodes are per-cpu. There is no actual bug here as the value was not dereferenced directly and passed to per_cpu_ptr, so this is just to suppress the warning/errors at compile time.
--- kernel/locking/qspinlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/qspinlock.h +1 -1
@@ -59,7 +59,7 @@ static inline __pure u32 encode_tail(int cpu, int idx)return tail; } -static inline __pure struct mcs_spinlock *decode_tail (u32 tail,struct qnode *qnodes) +static inline __pure struct mcs_spinlock *decode_tail (u32 tail,struct qnode __percpu *qnodes) {int cpu = (tail >> _Q_TAIL_CPU_OFFSET) -1 ;int idx = (tail & _Q_TAIL_IDX_MASK) >> _Q_TAIL_IDX_OFFSET;
--
2.47.1
Alexei Starovoitov
AppliedQuoted 19 lines · Kumar Kartikeya Dwivedi
The
decode_tailfunction now takes a qnode argument to use distinct qnodes for qspinlock and rqspinlock. Add a__percputag to avoid warnings and errors and reflect that the qnodes are per-cpu. There is no actual bug here as the value was not dereferenced directly and passed toper_cpu_ptr, so this is just to suppress the warning/errors at compile time.Fixes 06988910ee2d ("locking: Move common qspinlock helpers to a private header")Signed-off-by Kumar Kartikeya Dwivedi <[email protected]>--- kernel/locking/qspinlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/locking/qspinlock.h +0
-0
kernel/locking/qspinlock.h static inline __pure u32 encode_tail(int cpu, int idx) · line 62
Quoted 5 lines
kernel/locking/qspinlock.h +1
-1@@ -59,7 +59,7 @@ static inline __pure u32 encode_tail(int cpu, int idx)return tail; } -static inline __pure struct mcs_spinlock *decode_tail (u32 tail,struct qnode *qnodes) +static inline __pure struct mcs_spinlock *decode_tail (u32 tail,struct qnode __percpu *qnodes)
Applied. Decided to squash it in and adjusted to
new line to make it shorter.