From: Simona Vetter <simona.vetter@ffwll.ch>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Christian Brauner" <brauner@kernel.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Maarten Lankhorst" <dev@lankhorst.se>,
"Natalie Vock" <natalie.vock@gmx.de>,
linux-kernel@vger.kernel.org, rcu@vger.kernel.org,
cgroups@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Frederic Weisbecker" <frederic@kernel.org>,
"Neeraj Upadhyay" <neeraj.upadhyay@kernel.org>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
"Josh Triplett" <josh@joshtriplett.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Uladzislau Rezki" <urezki@gmail.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
"Lai Jiangshan" <jiangshanlai@gmail.com>,
Zqiang <qiang.zhang@linux.dev>,
"Maxime Ripard" <mripard@kernel.org>, "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>
Subject: Re: [PATCH v1 1/1] rculist: move list_for_each_rcu() to where it belongs
Date: Fri, 11 Jul 2025 11:04:31 +0200 [thread overview]
Message-ID: <aHDTn5JgXOpiG_zd@phenom.ffwll.local> (raw)
In-Reply-To: <20250710121528.780875-1-andriy.shevchenko@linux.intel.com>
On Thu, Jul 10, 2025 at 03:15:28PM +0300, Andy Shevchenko wrote:
> 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>
Also ack for the dmem part for merging through your tree.
-Sima
> ---
> include/linux/list.h | 10 ----------
> include/linux/rculist.h | 10 ++++++++++
> kernel/cgroup/dmem.c | 1 +
> 3 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/list.h b/include/linux/list.h
> index e7e28afd28f8..e7bdad9b8618 100644
> --- a/include/linux/list.h
> +++ b/include/linux/list.h
> @@ -686,16 +686,6 @@ static inline void list_splice_tail_init(struct list_head *list,
> #define list_for_each(pos, head) \
> for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
>
> -/**
> - * list_for_each_rcu - Iterate over a list in an RCU-safe fashion
> - * @pos: the &struct list_head to use as a loop cursor.
> - * @head: the head for your list.
> - */
> -#define list_for_each_rcu(pos, head) \
> - for (pos = rcu_dereference((head)->next); \
> - !list_is_head(pos, (head)); \
> - pos = rcu_dereference(pos->next))
> -
> /**
> * list_for_each_continue - continue iteration over a list
> * @pos: the &struct list_head to use as a loop cursor.
> diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> index 1b11926ddd47..2abba7552605 100644
> --- a/include/linux/rculist.h
> +++ b/include/linux/rculist.h
> @@ -42,6 +42,16 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
> */
> #define list_bidir_prev_rcu(list) (*((struct list_head __rcu **)(&(list)->prev)))
>
> +/**
> + * list_for_each_rcu - Iterate over a list in an RCU-safe fashion
> + * @pos: the &struct list_head to use as a loop cursor.
> + * @head: the head for your list.
> + */
> +#define list_for_each_rcu(pos, head) \
> + for (pos = rcu_dereference((head)->next); \
> + !list_is_head(pos, (head)); \
> + pos = rcu_dereference(pos->next))
> +
> /**
> * list_tail_rcu - returns the prev pointer of the head of the list
> * @head: the head of the list
> diff --git a/kernel/cgroup/dmem.c b/kernel/cgroup/dmem.c
> index 10b63433f057..e12b946278b6 100644
> --- a/kernel/cgroup/dmem.c
> +++ b/kernel/cgroup/dmem.c
> @@ -14,6 +14,7 @@
> #include <linux/mutex.h>
> #include <linux/page_counter.h>
> #include <linux/parser.h>
> +#include <linux/rculist.h>
> #include <linux/slab.h>
>
> struct dmem_cgroup_region {
> --
> 2.47.2
>
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2025-07-11 9:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 12:15 [PATCH v1 1/1] rculist: move list_for_each_rcu() to where it belongs Andy Shevchenko
2025-07-11 9:04 ` Simona Vetter [this message]
2025-07-11 14:12 ` Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aHDTn5JgXOpiG_zd@phenom.ffwll.local \
--to=simona.vetter@ffwll.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=boqun.feng@gmail.com \
--cc=brauner@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=dev@lankhorst.se \
--cc=dri-devel@lists.freedesktop.org \
--cc=frederic@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mkoutny@suse.com \
--cc=mripard@kernel.org \
--cc=natalie.vock@gmx.de \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tj@kernel.org \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).