Skip to contentSkip to conversation

rcuscale: add srcua scale type

PATCH In review Kunwu Chan 4 participants 7 messages Oct 3 – Oct 4

Subsystems (2)
lore
Share & tools
lore

Kunwu Chan

author
#0 lore raw

PATCH v2 1/1 rcuscale: add srcua scale type

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.

---
 kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

1: why didn't u cc me
2: why did you ommit my tag? I tend to review based on correctness, cuz idk pauls preferences, once I do I'll be a better rcu reviewer.

Quoted 80 lines

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.
---
kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-

1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))
Quoted 2 lines

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

--- Thanks!
"I'm not a very positive person" - Linus torvalds

maintainer
#2 lore raw
Quoted 10 lines · Bradley Morgan
Quoted 6 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

1: why didn't u cc me
2: why did you ommit my tag? I tend to review based on correctness, cuz idk pauls preferences, once I do I'll be a better rcu reviewer.

Take it easy, Bradley.

Many in the Linux kernel community consider it polite to drop a tag from (or, as in this case, avoid adding a tag to) a patch that changed significantly. On the CC issue, you did find the patch the first time without him CCing you. ;-)

Kunwu did nothing wrong here.

Thanx, Paul

Quoted 85 lines
Quoted 80 lines

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.
---
kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-

1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))
Quoted 2 lines

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

--- Thanks!
"I'm not a very positive person" - Linus torvalds

#3 lore raw
Quoted 13 lines · Paul E. McKenney
Quoted 10 lines · Bradley Morgan
Quoted 6 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

1: why didn't u cc me
2: why did you ommit my tag? I tend to review based on correctness, cuz

idk pauls preferences, once I do I'll be a better rcu reviewer.

Quoted 8 lines

Take it easy, Bradley.

Many in the Linux kernel community consider it polite to drop a tag from (or, as in this case, avoid adding a tag to) a patch that changed significantly. On the CC issue, you did find the patch the first time without him CCing you. ;-)

Kunwu did nothing wrong here.

I'm annoyed but not mad, no grudges taken..

Quoted 15 lines

Thanx, Paul

Quoted 12 lines
Quoted 12 lines

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

Quoted 74 lines
Quoted 1 line
Quoted 1 line

v1:

https://lore.kernel.org/all/[email protected]/

Quoted 72 lines
Quoted 67 lines

Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.
---
kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-

1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))
Quoted 2 lines

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

--- Thanks!
"I'm not a very positive person" - Linus torvalds

--- Thanks!
"I'm not a very positive person" - Linus torvalds

maintainer
#4 lore raw
In reply to Kunwu Chan
Quoted 6 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

Queued for testing and further review, thank you!!!

Thanx, Paul

Quoted 84 lines

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.

---
 kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

Signature · 1 line
2.43.0
maintainer Reviewed-by on v2 1/1
#5 lore raw
In reply to Kunwu Chan
Quoted 18 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

Quoted 5 lines

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.
---

Maybe some performance numbers too for an rcuscale patch? ;-) But either way:

Quoted 64 lines
 kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
 	.name		= "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+	return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+	srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+	synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+	srcu_ctlp = &srcua;
+	init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+	.ptype		= SRCU_FLAVOR,
+	.init		= srcu_atomic_scale_init,
+	.cleanup	= srcu_sync_scale_cleanup,
+	.readlock	= srcu_scale_atomic_read_lock,
+	.readunlock	= srcu_scale_atomic_read_unlock,
+	.get_gp_seq	= srcu_scale_completed,
+	.gp_diff	= rcu_seq_diff,
+	.exp_completed	= srcu_scale_completed,
+	.sync		= srcu_scale_atomic_synchronize,
+	.exp_sync	= srcu_scale_atomic_synchronize,
+	.stats		= srcu_scale_stats,
+	.name		= "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
 	long i;
 	long j;
 	static struct rcu_scale_ops *scale_ops[] = {
-		&rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+		&rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+		TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
 	};
 
 	if (!torture_init_begin(scale_type, verbose))

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

Signature · 1 line
Joel Fernandes
author
#6 lore raw
Quoted 26 lines · Joel Fernandes
Quoted 18 lines · Kunwu Chan

Add support for scaling atomic SRCU grace periods using srcu_read_lock_atomic()/srcu_read_unlock_atomic() and synchronize_srcu_atomic().

---
Changes since v1:
- Rename srcu_atomic_ctlp to srcua and reuse srcu_ctlp for SRCU operations, as suggested by Paul.
- Reuse the existing SRCU cleanup and completed helpers by initializing srcu_ctlp in srcu_atomic_scale_init().
- Add .stats using srcu_scale_stats().
- Use "srcua" to match the existing "srcu" and "srcud" scale type names.
- Use synchronize_srcu_atomic() for both normal and expedited scale tests.

Quoted 5 lines

v1: https://lore.kernel.org/all/[email protected]/
Tested with kvm.sh --torture rcuscale scale_type=srcua on x86_64 and arm64, alongside gp_exp=1 and PROVE_LOCKING=y: no warnings or lockdep splats.
---

Quoted 3 lines

Maybe some performance numbers too for an rcuscale patch? ;-) But either way:

Thanks Joel for the review!

Here are the rcuscale numbers. All tests were run with kvm.sh --torture rcuscale using scale_type=srcua on 12-CPU x86_64 and 256-CPU arm64 KVM guests, with and without PROVE_LOCKING.

All values below are synchronize_srcu_atomic() durations:

  Arch    CPUs  lockdep  gp_exp  median   P99      max
  x86_64   12      n        0    0.82us   1.57us    864us
  x86_64   12      n        1    0.87us   1.54us    857us
  x86_64   12      y        0    0.72us   0.93us     11us
  x86_64   12      y        1    0.66us   0.85us    160us
  arm64   256      n        0   26.2us   71.2us   3389us
  arm64   256      n        1   24.3us   60.6us  10513us
  arm64   256      y        0   13.4us   43.6us   4066us
  arm64   256      y        1    8.86us  22.6us   8004us

gp_exp=1 does not significantly change the distribution for srcua, since there is no separate expedited primitive for atomic SRCU.

For comparison, synchronize_srcu() on the same arm64 guest takes about 8ms under the same workload.

All runs completed without warnings, lockdep splats, or shutdown issues.

Thanks,
Kunwu

Quoted 73 lines
Quoted 68 lines




 kernel/rcu/rcuscale.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
kernel/rcu/rcuscale.c +40 -1
index 1097ec15879c..b172882824ac 100644
@@ -293,6 +293,44 @@ static struct rcu_scale_ops srcud_ops = {
      .name           = "srcud"
 };
 
+static struct srcu_struct srcua;
+
+static int srcu_scale_atomic_read_lock(void)
+{
+     return srcu_read_lock_atomic(srcu_ctlp);
+}
+
+static void srcu_scale_atomic_read_unlock(int idx)
+{
+     srcu_read_unlock_atomic(srcu_ctlp, idx);
+}
+
+static void srcu_scale_atomic_synchronize(void)
+{
+     synchronize_srcu_atomic(srcu_ctlp);
+}
+
+static void srcu_atomic_scale_init(void)
+{
+     srcu_ctlp = &srcua;
+     init_srcu_struct_atomic(srcu_ctlp);
+}
+
+static struct rcu_scale_ops srcua_ops = {
+     .ptype          = SRCU_FLAVOR,
+     .init           = srcu_atomic_scale_init,
+     .cleanup        = srcu_sync_scale_cleanup,
+     .readlock       = srcu_scale_atomic_read_lock,
+     .readunlock     = srcu_scale_atomic_read_unlock,
+     .get_gp_seq     = srcu_scale_completed,
+     .gp_diff        = rcu_seq_diff,
+     .exp_completed  = srcu_scale_completed,
+     .sync           = srcu_scale_atomic_synchronize,
+     .exp_sync       = srcu_scale_atomic_synchronize,
+     .stats          = srcu_scale_stats,
+     .name           = "srcua"
+};
+
 #ifdef CONFIG_TASKS_RCU
 
 /*
@@ -1110,7 +1148,8 @@ rcu_scale_init(void)
      long i;
      long j;
      static struct rcu_scale_ops *scale_ops[] = {
-             &rcu_ops, &srcu_ops, &srcud_ops, TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
+             &rcu_ops, &srcu_ops, &srcua_ops, &srcud_ops,
+             TASKS_OPS TASKS_RUDE_OPS TASKS_TRACING_OPS
      };
 
      if (!torture_init_begin(scale_type, verbose))
Quoted 1 line

base-commit: d21906b0aa1e9573cdb5e7acaca44966b9d1dcd2

--
Joel Fernandes