Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rculist: move list_for_each_rcu() to where it belongs

The list_for_each_rcu() relies on the rcu_dereference() API which is not
provided by the list.h. At the same time list.h is a low-level basic header
that must not have dependencies like RCU, besides the fact of the potential
circular dependencies in some cases. With all that said, move RCU related
API to the rculist.h where it belongs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
Reviewed-by: "Paul E. McKenney" <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.upadhyay@kernel.org>
Signed-off-by: "Paul E. McKenney" <paulmck@kernel.org>

authored by

Andy Shevchenko and committed by
Paul E. McKenney
a2143651 42d590d1

+11 -10
-10
include/linux/list.h
··· 687 687 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) 688 688 689 689 /** 690 - * list_for_each_rcu - Iterate over a list in an RCU-safe fashion 691 - * @pos: the &struct list_head to use as a loop cursor. 692 - * @head: the head for your list. 693 - */ 694 - #define list_for_each_rcu(pos, head) \ 695 - for (pos = rcu_dereference((head)->next); \ 696 - !list_is_head(pos, (head)); \ 697 - pos = rcu_dereference(pos->next)) 698 - 699 - /** 700 690 * list_for_each_continue - continue iteration over a list 701 691 * @pos: the &struct list_head to use as a loop cursor. 702 692 * @head: the head for your list.
+10
include/linux/rculist.h
··· 43 43 #define list_bidir_prev_rcu(list) (*((struct list_head __rcu **)(&(list)->prev))) 44 44 45 45 /** 46 + * list_for_each_rcu - Iterate over a list in an RCU-safe fashion 47 + * @pos: the &struct list_head to use as a loop cursor. 48 + * @head: the head for your list. 49 + */ 50 + #define list_for_each_rcu(pos, head) \ 51 + for (pos = rcu_dereference((head)->next); \ 52 + !list_is_head(pos, (head)); \ 53 + pos = rcu_dereference(pos->next)) 54 + 55 + /** 46 56 * list_tail_rcu - returns the prev pointer of the head of the list 47 57 * @head: the head of the list 48 58 *
+1
kernel/cgroup/dmem.c
··· 14 14 #include <linux/mutex.h> 15 15 #include <linux/page_counter.h> 16 16 #include <linux/parser.h> 17 + #include <linux/rculist.h> 17 18 #include <linux/slab.h> 18 19 19 20 struct dmem_cgroup_region {