* [PATCH 0/3] Miscellaneous RCU updates for v6.18
@ 2025-08-16 0:01 Paul E. McKenney
2025-08-16 0:01 ` [PATCH 1/3] rcu: Document that rcu_barrier() hurries lazy callbacks Paul E. McKenney
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Paul E. McKenney @ 2025-08-16 0:01 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt
Hello!
This series contains miscellaneous RCU updates for v6.18:
1. Document that rcu_barrier() hurries lazy callbacks.
2. Remove local_irq_save/restore() in
rcu_preempt_deferred_qs_handler(), courtesy of Zqiang.
3. move list_for_each_rcu() to where it belongs, courtesy of Andy
Shevchenko.
Thanx, Paul
------------------------------------------------------------------------
include/linux/list.h | 10 ----------
include/linux/rculist.h | 10 ++++++++++
kernel/cgroup/dmem.c | 1 +
kernel/rcu/tree.c | 5 +++++
kernel/rcu/tree_plugin.h | 5 +----
5 files changed, 17 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] rcu: Document that rcu_barrier() hurries lazy callbacks
2025-08-16 0:01 [PATCH 0/3] Miscellaneous RCU updates for v6.18 Paul E. McKenney
@ 2025-08-16 0:01 ` Paul E. McKenney
2025-08-16 0:01 ` [PATCH 2/3] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler() Paul E. McKenney
2025-08-16 0:01 ` [PATCH 3/3] rculist: move list_for_each_rcu() to where it belongs Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2025-08-16 0:01 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney
This commit adds to the rcu_barrier() kerneldoc header stating that this
function hurries lazy callbacks and that it does not normally result in
additional RCU grace periods.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 8eff357b0436be..1291e0761d70ab 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3800,6 +3800,11 @@ static void rcu_barrier_handler(void *cpu_in)
* to complete. For example, if there are no RCU callbacks queued anywhere
* in the system, then rcu_barrier() is within its rights to return
* immediately, without waiting for anything, much less an RCU grace period.
+ * In fact, rcu_barrier() will normally not result in any RCU grace periods
+ * beyond those that were already destined to be executed.
+ *
+ * In kernels built with CONFIG_RCU_LAZY=y, this function also hurries all
+ * pending lazy RCU callbacks.
*/
void rcu_barrier(void)
{
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler()
2025-08-16 0:01 [PATCH 0/3] Miscellaneous RCU updates for v6.18 Paul E. McKenney
2025-08-16 0:01 ` [PATCH 1/3] rcu: Document that rcu_barrier() hurries lazy callbacks Paul E. McKenney
@ 2025-08-16 0:01 ` Paul E. McKenney
2025-08-16 0:01 ` [PATCH 3/3] rculist: move list_for_each_rcu() to where it belongs Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2025-08-16 0:01 UTC (permalink / raw)
To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Zqiang, Paul E . McKenney
From: Zqiang <qiang.zhang@linux.dev>
The per-CPU rcu_data structure's ->defer_qs_iw field is initialized
by IRQ_WORK_INIT_HARD(), which means that the subsequent invocation of
rcu_preempt_deferred_qs_handler() will always be executed with interrupts
disabled. This commit therefore removes the local_irq_save/restore()
operations from rcu_preempt_deferred_qs_handler() and adds a call to
lockdep_assert_irqs_disabled() in order to enable lockdep to diagnose
mistaken invocations of this function from interrupts-enabled code.
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree_plugin.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 4cd170b2d6551d..d85763336b3c0f 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -626,11 +626,10 @@ notrace void rcu_preempt_deferred_qs(struct task_struct *t)
*/
static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
{
- unsigned long flags;
struct rcu_data *rdp;
+ lockdep_assert_irqs_disabled();
rdp = container_of(iwp, struct rcu_data, defer_qs_iw);
- local_irq_save(flags);
/*
* If the IRQ work handler happens to run in the middle of RCU read-side
@@ -647,8 +646,6 @@ static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
*/
if (rcu_preempt_depth() > 0)
WRITE_ONCE(rdp->defer_qs_iw_pending, DEFER_QS_IDLE);
-
- local_irq_restore(flags);
}
/*
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] rculist: move list_for_each_rcu() to where it belongs
2025-08-16 0:01 [PATCH 0/3] Miscellaneous RCU updates for v6.18 Paul E. McKenney
2025-08-16 0:01 ` [PATCH 1/3] rcu: Document that rcu_barrier() hurries lazy callbacks Paul E. McKenney
2025-08-16 0:01 ` [PATCH 2/3] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler() Paul E. McKenney
@ 2025-08-16 0:01 ` Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2025-08-16 0:01 UTC (permalink / raw)
To: rcu
Cc: linux-kernel, kernel-team, rostedt, Andy Shevchenko,
Simona Vetter, Paul E. McKenney, Neeraj Upadhyay
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
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>
---
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 e7e28afd28f8ee..e7bdad9b861827 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 1b11926ddd4710..2abba7552605c5 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 10b63433f05737..e12b946278b6c6 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.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-16 0:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-16 0:01 [PATCH 0/3] Miscellaneous RCU updates for v6.18 Paul E. McKenney
2025-08-16 0:01 ` [PATCH 1/3] rcu: Document that rcu_barrier() hurries lazy callbacks Paul E. McKenney
2025-08-16 0:01 ` [PATCH 2/3] rcu: Remove local_irq_save/restore() in rcu_preempt_deferred_qs_handler() Paul E. McKenney
2025-08-16 0:01 ` [PATCH 3/3] rculist: move list_for_each_rcu() to where it belongs Paul E. McKenney
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).