[PATCH v2] rcu: Improve comments for RCU_FANOUT and RCU_FANOUT_LEAF

Kunwu Chan posted 1 patch 1 week, 6 days ago
include/linux/rcu_node_tree.h | 8 ++++++++
1 file changed, 8 insertions(+)
[PATCH v2] rcu: Improve comments for RCU_FANOUT and RCU_FANOUT_LEAF
Posted by Kunwu Chan 1 week, 6 days ago
From: Kunwu Chan <chentao@kylinos.cn>

Add explicit explanations of the overall purpose of RCU_FANOUT and
RCU_FANOUT_LEAF parameters: defining middle/leaf fan-out parameters,
their relation to Kconfig, and how they shape the RCU hierarchy based
on CPU count.

This makes the hierarchical configuration logic of the RCU easier to
understand.

Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
Changes in v2:
- Restores the original #else #endif comment format
- Reword commit msg
---
 include/linux/rcu_node_tree.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/rcu_node_tree.h b/include/linux/rcu_node_tree.h
index 78feb8ba7358..a87ca215de4b 100644
--- a/include/linux/rcu_node_tree.h
+++ b/include/linux/rcu_node_tree.h
@@ -25,11 +25,18 @@
 /*
  * Define shape of hierarchy based on NR_CPUS, CONFIG_RCU_FANOUT, and
  * CONFIG_RCU_FANOUT_LEAF.
+ * - RCU_FANOUT: Controls fan-out of middle levels in the RCU hierarchy.
+ * - RCU_FANOUT_LEAF: Controls fan-out of the leaf level (directly managing CPUs).
+ *
+ * These parameters are determined by Kconfig options if configured; otherwise,
+ * they use sensible defaults based on system architecture (for RCU_FANOUT)
+ * or a fixed default (for RCU_FANOUT_LEAF).
  * In theory, it should be possible to add more levels straightforwardly.
  * In practice, this did work well going from three levels to four.
  * Of course, your mileage may vary.
  */
 
+/* Define RCU_FANOUT: middle-level fan-out parameter */
 #ifdef CONFIG_RCU_FANOUT
 #define RCU_FANOUT CONFIG_RCU_FANOUT
 #else /* #ifdef CONFIG_RCU_FANOUT */
@@ -40,6 +47,7 @@
 # endif
 #endif /* #else #ifdef CONFIG_RCU_FANOUT */
 
+/* Define RCU_FANOUT_LEAF: leaf-level fan-out parameter (manages CPUs directly) */
 #ifdef CONFIG_RCU_FANOUT_LEAF
 #define RCU_FANOUT_LEAF CONFIG_RCU_FANOUT_LEAF
 #else /* #ifdef CONFIG_RCU_FANOUT_LEAF */
-- 
2.25.1