LinuxKPI: Add compiler barriers to list_for_each_entry_lockless macro
so this list-traversal primitive may safely run concurrently with the _rcu list-mutation primitives such as list_add_rcu() as long as the traversal is guarded by rcu_read_lock(). Do it by reusing the "list_for_each_entry_rcu" macro which does the same. On Linux it implements some additional lockdep stuff which we skip. Also move the macro to linux/rculist.h where it resides on Linux. Reviewed by: hselasky Differential revision: https://reviews.freebsd.org/D30795
This commit is contained in:
parent
c77ec79b57
commit
c0862b2b1f
@ -202,8 +202,6 @@ list_del_init(struct list_head *entry)
|
||||
for (p = list_entry((h)->next, typeof(*p), field); &(p)->field != (h); \
|
||||
p = list_entry((p)->field.next, typeof(*p), field))
|
||||
|
||||
#define list_for_each_entry_lockless(...) list_for_each_entry(__VA_ARGS__)
|
||||
|
||||
#define list_for_each_entry_safe(p, n, h, field) \
|
||||
for (p = list_entry((h)->next, typeof(*p), field), \
|
||||
n = list_entry((p)->field.next, typeof(*p), field); &(p)->field != (h);\
|
||||
|
@ -44,6 +44,9 @@
|
||||
&(pos)->member != (head); \
|
||||
pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member))
|
||||
|
||||
#define list_for_each_entry_lockless(pos, head, member) \
|
||||
list_for_each_entry_rcu(pos, head, member)
|
||||
|
||||
static inline void
|
||||
linux_list_add_rcu(struct list_head *new, struct list_head *prev,
|
||||
struct list_head *next)
|
||||
|
Loading…
x
Reference in New Issue
Block a user