Patch "rcu: add a helper to report consolidated flavor QS" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    rcu: add a helper to report consolidated flavor QS

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rcu-add-a-helper-to-report-consolidated-flavor-qs.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7f8ef8fa7550564abba9bdeaf20658d97938cf49
Author: Yan Zhai <yan@xxxxxxxxxxxxxx>
Date:   Tue Mar 19 13:44:34 2024 -0700

    rcu: add a helper to report consolidated flavor QS
    
    [ Upstream commit 1a77557d48cff187a169c2aec01c0dd78a5e7e50 ]
    
    When under heavy load, network processing can run CPU-bound for many
    tens of seconds. Even in preemptible kernels (non-RT kernel), this can
    block RCU Tasks grace periods, which can cause trace-event removal to
    take more than a minute, which is unacceptably long.
    
    This commit therefore creates a new helper function that passes through
    both RCU and RCU-Tasks quiescent states every 100 milliseconds. This
    hard-coded value suffices for current workloads.
    
    Suggested-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
    Reviewed-by: Jesper Dangaard Brouer <hawk@xxxxxxxxxx>
    Signed-off-by: Yan Zhai <yan@xxxxxxxxxxxxxx>
    Reviewed-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
    Acked-by: Jesper Dangaard Brouer <hawk@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/90431d46ee112d2b0af04dbfe936faaca11810a5.1710877680.git.yan@xxxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Stable-dep-of: 00bf63122459 ("bpf: report RCU QS in cpumap kthread")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index cf139d6e5c1d3..38a9730b685b9 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -196,6 +196,37 @@ do { \
 	cond_resched(); \
 } while (0)
 
+/**
+ * rcu_softirq_qs_periodic - Report RCU and RCU-Tasks quiescent states
+ * @old_ts: jiffies at start of processing.
+ *
+ * This helper is for long-running softirq handlers, such as NAPI threads in
+ * networking. The caller should initialize the variable passed in as @old_ts
+ * at the beginning of the softirq handler. When invoked frequently, this macro
+ * will invoke rcu_softirq_qs() every 100 milliseconds thereafter, which will
+ * provide both RCU and RCU-Tasks quiescent states. Note that this macro
+ * modifies its old_ts argument.
+ *
+ * Because regions of code that have disabled softirq act as RCU read-side
+ * critical sections, this macro should be invoked with softirq (and
+ * preemption) enabled.
+ *
+ * The macro is not needed when CONFIG_PREEMPT_RT is defined. RT kernels would
+ * have more chance to invoke schedule() calls and provide necessary quiescent
+ * states. As a contrast, calling cond_resched() only won't achieve the same
+ * effect because cond_resched() does not provide RCU-Tasks quiescent states.
+ */
+#define rcu_softirq_qs_periodic(old_ts) \
+do { \
+	if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \
+	    time_after(jiffies, (old_ts) + HZ / 10)) { \
+		preempt_disable(); \
+		rcu_softirq_qs(); \
+		preempt_enable(); \
+		(old_ts) = jiffies; \
+	} \
+} while (0)
+
 /*
  * Infrastructure to implement the synchronize_() primitives in
  * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux