Skip to contentSkip to conversation

srcu: remove never used variable

PATCH In review [email protected] 2 participants 4 messages Feb 22, 2018 – Feb 23, 2018 1 message not in the archive Sleepable read-copy update (SRCU)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 srcu: remove never used variable

From: Zhouyi Zhou <[email protected]>

In function srcu_gp_end, the variable idxnext is never used after assign, remove it and its assign statement.

---
 kernel/rcu/srcutree.c | 2 --
 1 file changed, 2 deletions(-)
kernel/rcu/srcutree.c +0 -2
index d5cea81..1241715 100644
@@ -531,7 +531,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 	unsigned long flags;
 	unsigned long gpseq;
 	int idx;
-	int idxnext;
 	unsigned long mask;
 	struct srcu_data *sdp;
 	struct srcu_node *snp;
@@ -555,7 +554,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 
 	/* Initiate callback invocation as needed. */
 	idx = rcu_seq_ctr(gpseq) % ARRAY_SIZE(snp->srcu_have_cbs);
-	idxnext = (idx + 1) % ARRAY_SIZE(snp->srcu_have_cbs);
 	rcu_for_each_node_breadth_first(sp, snp) {
 		spin_lock_irq_rcu_node(snp);
 		cbs = false;
Signature · 1 line
2.1.4
#1 lore raw
Quoted 6 lines · On Thu, Feb 22, 2018 at 06:52:37AM +0000, [email protected] wrote:

From: Zhouyi Zhou <[email protected]>

In function srcu_gp_end, the variable idxnext is never used after assign, remove it and its assign statement.

Good catch, but Byungchul Park beat you to it. Please see commit a72da917f186 ("srcu: Remove dead code in srcu_gp_end()") in -rcu.

Thanx, Paul

Quoted 27 lines
---
 kernel/rcu/srcutree.c | 2 --
 1 file changed, 2 deletions(-)
kernel/rcu/srcutree.c +0 -2
index d5cea81..1241715 100644
@@ -531,7 +531,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 	unsigned long flags;
 	unsigned long gpseq;
 	int idx;
-	int idxnext;
 	unsigned long mask;
 	struct srcu_data *sdp;
 	struct srcu_node *snp;
@@ -555,7 +554,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 
 	/* Initiate callback invocation as needed. */
 	idx = rcu_seq_ctr(gpseq) % ARRAY_SIZE(snp->srcu_have_cbs);
-	idxnext = (idx + 1) % ARRAY_SIZE(snp->srcu_have_cbs);
 	rcu_for_each_node_breadth_first(sp, snp) {
 		spin_lock_irq_rcu_node(snp);
 		cbs = false;
Signature · 1 line
2.1.4

A message that is not in the archive (sent off-list or not yet received): CAABZP2wt0QLuOFndOFTgRACxZw0jqNNeumE91KpjiFQieg14dA@mail.gmail.com

#3 lore raw
Quoted 1 line · Zhouyi Zhou

Thanks Paul for reviewing

And thank you for your interest in SRCU! I am pretty sure that other bugs still remain. ;-)

Thanx, Paul

Quoted 48 lines

Cheers
Zhouyi

Quoted 42 lines · Paul E. McKenney
Quoted 6 lines · On Thu, Feb 22, 2018 at 06:52:37AM +0000, [email protected] wrote:

From: Zhouyi Zhou <[email protected]>

In function srcu_gp_end, the variable idxnext is never used after assign, remove it and its assign statement.

Good catch, but Byungchul Park beat you to it. Please see commit a72da917f186 ("srcu: Remove dead code in srcu_gp_end()") in -rcu.

Thanx, Paul

Quoted 27 lines
---
 kernel/rcu/srcutree.c | 2 --
 1 file changed, 2 deletions(-)
kernel/rcu/srcutree.c +0 -3
index d5cea81..1241715 100644
@@ -531,7 +531,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
      unsigned long flags;
      unsigned long gpseq;
      int idx;
-     int idxnext;
      unsigned long mask;
      struct srcu_data *sdp;
      struct srcu_node *snp;
@@ -555,7 +554,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 
      /* Initiate callback invocation as needed. */
      idx = rcu_seq_ctr(gpseq) % ARRAY_SIZE(snp->srcu_have_cbs);
-     idxnext = (idx + 1) % ARRAY_SIZE(snp->srcu_have_cbs);
      rcu_for_each_node_breadth_first(sp, snp) {
              spin_lock_irq_rcu_node(snp);
              cbs = false;
--

2.1.4

#4 lore raw

Thanks Paul's encouragement, I will keep studying SRCU code.

Quoted 57 lines · Paul E. McKenney
Quoted 1 line · Zhouyi Zhou

Thanks Paul for reviewing

And thank you for your interest in SRCU! I am pretty sure that other bugs still remain. ;-)

Thanx, Paul

Quoted 48 lines

Cheers
Zhouyi

Quoted 42 lines · Paul E. McKenney
Quoted 6 lines · On Thu, Feb 22, 2018 at 06:52:37AM +0000, [email protected] wrote:

From: Zhouyi Zhou <[email protected]>

In function srcu_gp_end, the variable idxnext is never used after assign, remove it and its assign statement.

Good catch, but Byungchul Park beat you to it. Please see commit a72da917f186 ("srcu: Remove dead code in srcu_gp_end()") in -rcu.

Thanx, Paul

Quoted 27 lines
---
 kernel/rcu/srcutree.c | 2 --
 1 file changed, 2 deletions(-)
kernel/rcu/srcutree.c +0 -3
index d5cea81..1241715 100644
@@ -531,7 +531,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
      unsigned long flags;
      unsigned long gpseq;
      int idx;
-     int idxnext;
      unsigned long mask;
      struct srcu_data *sdp;
      struct srcu_node *snp;
@@ -555,7 +554,6 @@ static void srcu_gp_end(struct srcu_struct *sp)
 
      /* Initiate callback invocation as needed. */
      idx = rcu_seq_ctr(gpseq) % ARRAY_SIZE(snp->srcu_have_cbs);
-     idxnext = (idx + 1) % ARRAY_SIZE(snp->srcu_have_cbs);
      rcu_for_each_node_breadth_first(sp, snp) {
              spin_lock_irq_rcu_node(snp);
              cbs = false;
--

2.1.4