Skip to contentSkip to conversation

rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled

PATCH Superseded Zqiang 2 participants 3 messages Oct 19, 2022 – Oct 20, 2022 RCU

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH v2 1/1 rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled

Currently, regardless of whether the CONFIG_RCU_LAZY is enabled, invoke the call_rcu() is always lazy, it also means that when CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also lazy. therefore, this commit make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled.

---
v1->v2:
Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.

 kernel/rcu/tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/tree.c +4 -1
index abc615808b6e..ecf42b0d3726 100644
@@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
  */
 void call_rcu(struct rcu_head *head, rcu_callback_t func)
 {
-	return __call_rcu_common(head, func, true);
+	if (IS_ENABLED(CONFIG_RCU_LAZY))
+		return __call_rcu_common(head, func, true);
+	else
+		return __call_rcu_common(head, func, false);
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 19 lines · Zqiang

Currently, regardless of whether the CONFIG_RCU_LAZY is enabled, invoke the call_rcu() is always lazy, it also means that when CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also lazy. therefore, this commit make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled.

---
v1->v2:
Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.

 kernel/rcu/tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/tree.c +0 -0
index abc615808b6e..ecf42b0d3726 100644

kernel/rcu/tree.c EXPORT_SYMBOL_GPL(call_rcu_flush); · line 2893

Quoted 8 lines
kernel/rcu/tree.c +4 -1
@@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
  */
 void call_rcu(struct rcu_head *head, rcu_callback_t func)
 {
-	return __call_rcu_common(head, func, true);
+	if (IS_ENABLED(CONFIG_RCU_LAZY))
+		return __call_rcu_common(head, func, true);
+	else
+		return __call_rcu_common(head, func, false);

This is much better, but why not something like this?

	return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));

							Thanx, Paul
Quoted 6 lines
kernel/rcu/tree.c +0 -0
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
Signature · 1 line
2.25.1
#2 lore raw
Quoted 29 lines · Zqiang

Currently, regardless of whether the CONFIG_RCU_LAZY is enabled, invoke the call_rcu() is always lazy, it also means that when CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also lazy. therefore, this commit make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled.

---
v1->v2:
Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.

 kernel/rcu/tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/tree.c +4 -1
index abc615808b6e..ecf42b0d3726 100644
@@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
  */
 void call_rcu(struct rcu_head *head, rcu_callback_t func)
 {
-	return __call_rcu_common(head, func, true);
+	if (IS_ENABLED(CONFIG_RCU_LAZY))
+		return __call_rcu_common(head, func, true);
+	else
+		return __call_rcu_common(head, func, false);
 
 
Quoted 1 line

This is much better, but why not something like this?

Yes, it looks better, 😊.

Quoted 11 lines
	return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));

							Thanx, Paul

}
EXPORT_SYMBOL_GPL(call_rcu);

Signature · 1 line
2.25.1