diff options
author | Paul E. McKenney <[email protected]> | 2021-06-24 18:05:51 +0200 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2021-06-24 19:41:14 +0200 |
commit | b9964ce74544ea6cbc4eabd2c89a531adf7f291d (patch) | |
tree | 98f9f383bb65b166cf62c54da71080d22aee6023 /scripts/gdb/linux/tasks.py | |
parent | 0bc919d3e0b8149a60d2444c6a8e2b5974556522 (diff) |
rcu: Create an unrcu_pointer() to remove __rcu from a pointer
The xchg() and cmpxchg() functions are sometimes used to carry out RCU
updates. Unfortunately, this can result in sparse warnings for both
the old-value and new-value arguments, as well as for the return value.
The arguments can be dealt with using RCU_INITIALIZER():
old_p = xchg(&p, RCU_INITIALIZER(new_p));
But a sparse warning still remains due to assigning the __rcu pointer
returned from xchg to the (most likely) non-__rcu pointer old_p.
This commit therefore provides an unrcu_pointer() macro that strips
the __rcu. This macro can be used as follows:
old_p = unrcu_pointer(xchg(&p, RCU_INITIALIZER(new_p)));
Reported-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'scripts/gdb/linux/tasks.py')
0 files changed, 0 insertions, 0 deletions