diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2020-04-19 23:46:16 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2020-04-21 22:15:13 +0200 |
commit | 24e4728559568f86a527d54a38c0207a418d42f0 (patch) | |
tree | 9b8c656d07659c1344f2f7d060cdf0ef39473315 | |
parent | 3e6ba29ee5d20b0c4128d3a3faf10663bfed633a (diff) | |
download | backports-24e4728559568f86a527d54a38c0207a418d42f0.tar.gz |
backports: rculist: Add additional parameter to list_for_each_entry_rcu()
Upstream commit 28875945ba98 ("rcu: Add support for consolidated-RCU
reader checking") adds a new paramater for lock checking to
list_for_each_entry_rcu().
Older kernel versions do not support CONFIG_PROVE_RCU_LIST, just
ignore the extra parameter.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r-- | backport/backport-include/linux/rculist.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/backport/backport-include/linux/rculist.h b/backport/backport-include/linux/rculist.h index 9671e7c4..967cdb86 100644 --- a/backport/backport-include/linux/rculist.h +++ b/backport/backport-include/linux/rculist.h @@ -1,6 +1,7 @@ #ifndef __BACKPORT_RCULIST_H #define __BACKPORT_RCULIST_H #include_next <linux/rculist.h> +#include <linux/version.h> #if LINUX_VERSION_IS_LESS(3,9,0) #include <backport/magic.h> @@ -54,4 +55,25 @@ }) #endif /* list_first_or_null_rcu */ + +#if LINUX_VERSION_IS_LESS(5,4,0) + +/** + * list_for_each_entry_rcu - iterate over rcu list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_head within the struct. + * @cond...: optional lockdep expression if called from non-RCU protection. + * + * 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(). + */ +#undef list_for_each_entry_rcu +#define list_for_each_entry_rcu(pos, head, member, cond...) \ + for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) +#endif /* < 5.4 */ + #endif /* __BACKPORT_RCULIST_H */ |