* [PATCH 0/4] rcu: trivial adjust for comments
@ 2020-06-12 2:07 Wei Yang
2020-06-12 2:07 ` [PATCH 1/4] rcu: gp_max is protected by root rcu_node's lock Wei Yang
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Wei Yang @ 2020-06-12 2:07 UTC (permalink / raw)
To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial
Cc: rcu, linux-kernel, Wei Yang
During code reading, I found there are several mismatch between comments
and code implementation.
Adjust the comment for better understanding.
Wei Yang (4):
rcu: gp_max is protected by root rcu_node's lock
rcu: grplo/grphi just records CPU number
rcu: grpnum just records group number
rcu: use gp_seq instead of rcu_gp_seq for consistency
kernel/rcu/tree.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--
2.20.1 (Apple Git-117)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] rcu: gp_max is protected by root rcu_node's lock
2020-06-12 2:07 [PATCH 0/4] rcu: trivial adjust for comments Wei Yang
@ 2020-06-12 2:07 ` Wei Yang
2020-06-12 2:07 ` [PATCH 2/4] rcu: grplo/grphi just records CPU number Wei Yang
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Wei Yang @ 2020-06-12 2:07 UTC (permalink / raw)
To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial
Cc: rcu, linux-kernel, Wei Yang
gp_max is protected by root rcu_node's lock, let's move the definition
to the place where comments indicate.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
kernel/rcu/tree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 43991a40b084..ed9b534ad870 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -301,6 +301,8 @@ struct rcu_state {
u8 boost ____cacheline_internodealigned_in_smp;
/* Subject to priority boost. */
unsigned long gp_seq; /* Grace-period sequence #. */
+ unsigned long gp_max; /* Maximum GP duration in */
+ /* jiffies. */
struct task_struct *gp_kthread; /* Task for grace periods. */
struct swait_queue_head gp_wq; /* Where GP task waits. */
short gp_flags; /* Commands for GP task. */
@@ -346,8 +348,6 @@ struct rcu_state {
/* a reluctant CPU. */
unsigned long n_force_qs_gpstart; /* Snapshot of n_force_qs at */
/* GP start. */
- unsigned long gp_max; /* Maximum GP duration in */
- /* jiffies. */
const char *name; /* Name of structure. */
char abbr; /* Abbreviated name. */
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] rcu: grplo/grphi just records CPU number
2020-06-12 2:07 [PATCH 0/4] rcu: trivial adjust for comments Wei Yang
2020-06-12 2:07 ` [PATCH 1/4] rcu: gp_max is protected by root rcu_node's lock Wei Yang
@ 2020-06-12 2:07 ` Wei Yang
2020-06-12 2:07 ` [PATCH 3/4] rcu: grpnum just records group number Wei Yang
2020-06-12 2:07 ` [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency Wei Yang
3 siblings, 0 replies; 8+ messages in thread
From: Wei Yang @ 2020-06-12 2:07 UTC (permalink / raw)
To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial
Cc: rcu, linux-kernel, Wei Yang
We store lowest and highest CPU number belongs to a rcu_node, which is
not the group number.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
kernel/rcu/tree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index ed9b534ad870..ce9ab7371706 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -73,8 +73,8 @@ struct rcu_node {
unsigned long ffmask; /* Fully functional CPUs. */
unsigned long grpmask; /* Mask to apply to parent qsmask. */
/* Only one bit will be set in this mask. */
- int grplo; /* lowest-numbered CPU or group here. */
- int grphi; /* highest-numbered CPU or group here. */
+ int grplo; /* lowest-numbered CPU here. */
+ int grphi; /* highest-numbered CPU here. */
u8 grpnum; /* CPU/group number for next level up. */
u8 level; /* root is at level 0. */
bool wait_blkd_tasks;/* Necessary to wait for blocked tasks to */
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] rcu: grpnum just records group number
2020-06-12 2:07 [PATCH 0/4] rcu: trivial adjust for comments Wei Yang
2020-06-12 2:07 ` [PATCH 1/4] rcu: gp_max is protected by root rcu_node's lock Wei Yang
2020-06-12 2:07 ` [PATCH 2/4] rcu: grplo/grphi just records CPU number Wei Yang
@ 2020-06-12 2:07 ` Wei Yang
2020-06-12 2:07 ` [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency Wei Yang
3 siblings, 0 replies; 8+ messages in thread
From: Wei Yang @ 2020-06-12 2:07 UTC (permalink / raw)
To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial
Cc: rcu, linux-kernel, Wei Yang
grpnum in rcu_node means the position in its parent, which is not the
CPU number even in last level.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
kernel/rcu/tree.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index ce9ab7371706..512829eed545 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -75,7 +75,7 @@ struct rcu_node {
/* Only one bit will be set in this mask. */
int grplo; /* lowest-numbered CPU here. */
int grphi; /* highest-numbered CPU here. */
- u8 grpnum; /* CPU/group number for next level up. */
+ u8 grpnum; /* group number for next level up. */
u8 level; /* root is at level 0. */
bool wait_blkd_tasks;/* Necessary to wait for blocked tasks to */
/* exit RCU read-side critical sections */
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency
2020-06-12 2:07 [PATCH 0/4] rcu: trivial adjust for comments Wei Yang
` (2 preceding siblings ...)
2020-06-12 2:07 ` [PATCH 3/4] rcu: grpnum just records group number Wei Yang
@ 2020-06-12 2:07 ` Wei Yang
2020-06-12 14:12 ` Paul E. McKenney
3 siblings, 1 reply; 8+ messages in thread
From: Wei Yang @ 2020-06-12 2:07 UTC (permalink / raw)
To: paulmck, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial
Cc: rcu, linux-kernel, Wei Yang
Commit de30ad512a66 ("rcu: Introduce grace-period sequence numbers")
introduce gp_seq in rcu_state/rcu_node/rcu_data. And this field in last
two structure track the one in first.
While the comment use rcu_gp_seq which is a little misleading for
audience. Let's use the exact name gp_seq for consistency.
Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
---
kernel/rcu/tree.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 512829eed545..3356842bc185 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -41,7 +41,7 @@ struct rcu_node {
raw_spinlock_t __private lock; /* Root rcu_node's lock protects */
/* some rcu_state fields as well as */
/* following. */
- unsigned long gp_seq; /* Track rsp->rcu_gp_seq. */
+ unsigned long gp_seq; /* Track rsp->gp_seq. */
unsigned long gp_seq_needed; /* Track furthest future GP request. */
unsigned long completedqs; /* All QSes done for this node. */
unsigned long qsmask; /* CPUs or groups that need to switch in */
@@ -149,7 +149,7 @@ union rcu_noqs {
/* Per-CPU data for read-copy update. */
struct rcu_data {
/* 1) quiescent-state and grace-period handling : */
- unsigned long gp_seq; /* Track rsp->rcu_gp_seq counter. */
+ unsigned long gp_seq; /* Track rsp->gp_seq. */
unsigned long gp_seq_needed; /* Track furthest future GP request. */
union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */
bool core_needs_qs; /* Core waits for quiesc state. */
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency
2020-06-12 2:07 ` [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency Wei Yang
@ 2020-06-12 14:12 ` Paul E. McKenney
2020-06-12 22:10 ` Wei Yang
0 siblings, 1 reply; 8+ messages in thread
From: Paul E. McKenney @ 2020-06-12 14:12 UTC (permalink / raw)
To: Wei Yang
Cc: josh, rostedt, mathieu.desnoyers, jiangshanlai, joel, trivial,
rcu, linux-kernel
On Fri, Jun 12, 2020 at 10:07:55AM +0800, Wei Yang wrote:
> Commit de30ad512a66 ("rcu: Introduce grace-period sequence numbers")
> introduce gp_seq in rcu_state/rcu_node/rcu_data. And this field in last
> two structure track the one in first.
>
> While the comment use rcu_gp_seq which is a little misleading for
> audience. Let's use the exact name gp_seq for consistency.
>
> Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
I applied and pushed the others -- good eyes, and thank you!
This one does not apply. Could you please forward-port it to
the "dev" branch of -rcu?
git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
Thanx, Paul
> ---
> kernel/rcu/tree.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> index 512829eed545..3356842bc185 100644
> --- a/kernel/rcu/tree.h
> +++ b/kernel/rcu/tree.h
> @@ -41,7 +41,7 @@ struct rcu_node {
> raw_spinlock_t __private lock; /* Root rcu_node's lock protects */
> /* some rcu_state fields as well as */
> /* following. */
> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq. */
> + unsigned long gp_seq; /* Track rsp->gp_seq. */
> unsigned long gp_seq_needed; /* Track furthest future GP request. */
> unsigned long completedqs; /* All QSes done for this node. */
> unsigned long qsmask; /* CPUs or groups that need to switch in */
> @@ -149,7 +149,7 @@ union rcu_noqs {
> /* Per-CPU data for read-copy update. */
> struct rcu_data {
> /* 1) quiescent-state and grace-period handling : */
> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq counter. */
> + unsigned long gp_seq; /* Track rsp->gp_seq. */
> unsigned long gp_seq_needed; /* Track furthest future GP request. */
> union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */
> bool core_needs_qs; /* Core waits for quiesc state. */
> --
> 2.20.1 (Apple Git-117)
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency
2020-06-12 14:12 ` Paul E. McKenney
@ 2020-06-12 22:10 ` Wei Yang
2020-06-12 23:17 ` Paul E. McKenney
0 siblings, 1 reply; 8+ messages in thread
From: Wei Yang @ 2020-06-12 22:10 UTC (permalink / raw)
To: Paul E. McKenney
Cc: Wei Yang, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
trivial, rcu, linux-kernel
On Fri, Jun 12, 2020 at 07:12:48AM -0700, Paul E. McKenney wrote:
>On Fri, Jun 12, 2020 at 10:07:55AM +0800, Wei Yang wrote:
>> Commit de30ad512a66 ("rcu: Introduce grace-period sequence numbers")
>> introduce gp_seq in rcu_state/rcu_node/rcu_data. And this field in last
>> two structure track the one in first.
>>
>> While the comment use rcu_gp_seq which is a little misleading for
>> audience. Let's use the exact name gp_seq for consistency.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
>
>I applied and pushed the others -- good eyes, and thank you!
>
>This one does not apply. Could you please forward-port it to
>the "dev" branch of -rcu?
>
The reason is someone has already fixed this :-)
>git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
>
> Thanx, Paul
>
>> ---
>> kernel/rcu/tree.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
>> index 512829eed545..3356842bc185 100644
>> --- a/kernel/rcu/tree.h
>> +++ b/kernel/rcu/tree.h
>> @@ -41,7 +41,7 @@ struct rcu_node {
>> raw_spinlock_t __private lock; /* Root rcu_node's lock protects */
>> /* some rcu_state fields as well as */
>> /* following. */
>> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq. */
>> + unsigned long gp_seq; /* Track rsp->gp_seq. */
>> unsigned long gp_seq_needed; /* Track furthest future GP request. */
>> unsigned long completedqs; /* All QSes done for this node. */
>> unsigned long qsmask; /* CPUs or groups that need to switch in */
>> @@ -149,7 +149,7 @@ union rcu_noqs {
>> /* Per-CPU data for read-copy update. */
>> struct rcu_data {
>> /* 1) quiescent-state and grace-period handling : */
>> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq counter. */
>> + unsigned long gp_seq; /* Track rsp->gp_seq. */
>> unsigned long gp_seq_needed; /* Track furthest future GP request. */
>> union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */
>> bool core_needs_qs; /* Core waits for quiesc state. */
>> --
>> 2.20.1 (Apple Git-117)
>>
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency
2020-06-12 22:10 ` Wei Yang
@ 2020-06-12 23:17 ` Paul E. McKenney
0 siblings, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2020-06-12 23:17 UTC (permalink / raw)
To: Wei Yang
Cc: Wei Yang, josh, rostedt, mathieu.desnoyers, jiangshanlai, joel,
trivial, rcu, linux-kernel
On Fri, Jun 12, 2020 at 10:10:25PM +0000, Wei Yang wrote:
> On Fri, Jun 12, 2020 at 07:12:48AM -0700, Paul E. McKenney wrote:
> >On Fri, Jun 12, 2020 at 10:07:55AM +0800, Wei Yang wrote:
> >> Commit de30ad512a66 ("rcu: Introduce grace-period sequence numbers")
> >> introduce gp_seq in rcu_state/rcu_node/rcu_data. And this field in last
> >> two structure track the one in first.
> >>
> >> While the comment use rcu_gp_seq which is a little misleading for
> >> audience. Let's use the exact name gp_seq for consistency.
> >>
> >> Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
> >
> >I applied and pushed the others -- good eyes, and thank you!
> >
> >This one does not apply. Could you please forward-port it to
> >the "dev" branch of -rcu?
>
> The reason is someone has already fixed this :-)
That would explain it! ;-)
Thanx, Paul
> >git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
> >
> > Thanx, Paul
> >
> >> ---
> >> kernel/rcu/tree.h | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
> >> index 512829eed545..3356842bc185 100644
> >> --- a/kernel/rcu/tree.h
> >> +++ b/kernel/rcu/tree.h
> >> @@ -41,7 +41,7 @@ struct rcu_node {
> >> raw_spinlock_t __private lock; /* Root rcu_node's lock protects */
> >> /* some rcu_state fields as well as */
> >> /* following. */
> >> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq. */
> >> + unsigned long gp_seq; /* Track rsp->gp_seq. */
> >> unsigned long gp_seq_needed; /* Track furthest future GP request. */
> >> unsigned long completedqs; /* All QSes done for this node. */
> >> unsigned long qsmask; /* CPUs or groups that need to switch in */
> >> @@ -149,7 +149,7 @@ union rcu_noqs {
> >> /* Per-CPU data for read-copy update. */
> >> struct rcu_data {
> >> /* 1) quiescent-state and grace-period handling : */
> >> - unsigned long gp_seq; /* Track rsp->rcu_gp_seq counter. */
> >> + unsigned long gp_seq; /* Track rsp->gp_seq. */
> >> unsigned long gp_seq_needed; /* Track furthest future GP request. */
> >> union rcu_noqs cpu_no_qs; /* No QSes yet for this CPU. */
> >> bool core_needs_qs; /* Core waits for quiesc state. */
> >> --
> >> 2.20.1 (Apple Git-117)
> >>
>
> --
> Wei Yang
> Help you, Help me
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-06-12 23:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 2:07 [PATCH 0/4] rcu: trivial adjust for comments Wei Yang
2020-06-12 2:07 ` [PATCH 1/4] rcu: gp_max is protected by root rcu_node's lock Wei Yang
2020-06-12 2:07 ` [PATCH 2/4] rcu: grplo/grphi just records CPU number Wei Yang
2020-06-12 2:07 ` [PATCH 3/4] rcu: grpnum just records group number Wei Yang
2020-06-12 2:07 ` [PATCH 4/4] rcu: use gp_seq instead of rcu_gp_seq for consistency Wei Yang
2020-06-12 14:12 ` Paul E. McKenney
2020-06-12 22:10 ` Wei Yang
2020-06-12 23:17 ` Paul E. McKenney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.