RCU Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH tip/core/rcu 1/1] rcu: Remove unused variable rcu_perf_writer_state
@ 2019-08-07 23:26 Ethan Hansen
  2019-08-07 23:41 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Ethan Hansen @ 2019-08-07 23:26 UTC (permalink / raw)
  To: rcu
  Cc: linux-kernel, dave, paulmck, josh, rostedt, mathieu.desnoyers,
	jiangshanlai, joel, Ethan Hansen

The variable rcu_perf_writer_state is declared and initialized,
but is never actually referenced. Remove it to clean code.

Signed-off-by: Ethan Hansen <1ethanhansen@gmail.com>
---
 kernel/rcu/rcuperf.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 5a879d0..ff02936 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -109,7 +109,6 @@
 static unsigned long b_rcu_perf_writer_finished;
 static DEFINE_PER_CPU(atomic_t, n_async_inflight);
 
-static int rcu_perf_writer_state;
 #define RTWS_INIT		0
 #define RTWS_ASYNC		1
 #define RTWS_BARRIER		2
@@ -404,25 +403,20 @@ static void rcu_perf_async_cb(struct rcu_head *rhp)
 			if (!rhp)
 				rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
 			if (rhp && atomic_read(this_cpu_ptr(&n_async_inflight)) < gp_async_max) {
-				rcu_perf_writer_state = RTWS_ASYNC;
 				atomic_inc(this_cpu_ptr(&n_async_inflight));
 				cur_ops->async(rhp, rcu_perf_async_cb);
 				rhp = NULL;
 			} else if (!kthread_should_stop()) {
-				rcu_perf_writer_state = RTWS_BARRIER;
 				cur_ops->gp_barrier();
 				goto retry;
 			} else {
 				kfree(rhp); /* Because we are stopping. */
 			}
 		} else if (gp_exp) {
-			rcu_perf_writer_state = RTWS_EXP_SYNC;
 			cur_ops->exp_sync();
 		} else {
-			rcu_perf_writer_state = RTWS_SYNC;
 			cur_ops->sync();
 		}
-		rcu_perf_writer_state = RTWS_IDLE;
 		t = ktime_get_mono_fast_ns();
 		*wdp = t - *wdp;
 		i_max = i;
@@ -463,10 +457,8 @@ static void rcu_perf_async_cb(struct rcu_head *rhp)
 		rcu_perf_wait_shutdown();
 	} while (!torture_must_stop());
 	if (gp_async) {
-		rcu_perf_writer_state = RTWS_BARRIER;
 		cur_ops->gp_barrier();
 	}
-	rcu_perf_writer_state = RTWS_STOPPING;
 	writer_n_durations[me] = i_max;
 	torture_kthread_stopping("rcu_perf_writer");
 	return 0;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH tip/core/rcu 1/1] rcu: Remove unused variable rcu_perf_writer_state
  2019-08-07 23:26 [PATCH tip/core/rcu 1/1] rcu: Remove unused variable rcu_perf_writer_state Ethan Hansen
@ 2019-08-07 23:41 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2019-08-07 23:41 UTC (permalink / raw)
  To: Ethan Hansen
  Cc: rcu, linux-kernel, dave, josh, rostedt, mathieu.desnoyers,
	jiangshanlai, joel

On Wed, Aug 07, 2019 at 04:26:55PM -0700, Ethan Hansen wrote:
> The variable rcu_perf_writer_state is declared and initialized,
> but is never actually referenced. Remove it to clean code.
> 
> Signed-off-by: Ethan Hansen <1ethanhansen@gmail.com>

Good eyes, thank you!  One question below.

							Thanx, Paul

> ---
>  kernel/rcu/rcuperf.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
> index 5a879d0..ff02936 100644
> --- a/kernel/rcu/rcuperf.c
> +++ b/kernel/rcu/rcuperf.c
> @@ -109,7 +109,6 @@
>  static unsigned long b_rcu_perf_writer_finished;
>  static DEFINE_PER_CPU(atomic_t, n_async_inflight);
>  
> -static int rcu_perf_writer_state;
>  #define RTWS_INIT		0
>  #define RTWS_ASYNC		1
>  #define RTWS_BARRIER		2

Does removing this variable also mean that the RTWS_* C preprocessor
macros are now unused?

> @@ -404,25 +403,20 @@ static void rcu_perf_async_cb(struct rcu_head *rhp)
>  			if (!rhp)
>  				rhp = kmalloc(sizeof(*rhp), GFP_KERNEL);
>  			if (rhp && atomic_read(this_cpu_ptr(&n_async_inflight)) < gp_async_max) {
> -				rcu_perf_writer_state = RTWS_ASYNC;
>  				atomic_inc(this_cpu_ptr(&n_async_inflight));
>  				cur_ops->async(rhp, rcu_perf_async_cb);
>  				rhp = NULL;
>  			} else if (!kthread_should_stop()) {
> -				rcu_perf_writer_state = RTWS_BARRIER;
>  				cur_ops->gp_barrier();
>  				goto retry;
>  			} else {
>  				kfree(rhp); /* Because we are stopping. */
>  			}
>  		} else if (gp_exp) {
> -			rcu_perf_writer_state = RTWS_EXP_SYNC;
>  			cur_ops->exp_sync();
>  		} else {
> -			rcu_perf_writer_state = RTWS_SYNC;
>  			cur_ops->sync();
>  		}
> -		rcu_perf_writer_state = RTWS_IDLE;
>  		t = ktime_get_mono_fast_ns();
>  		*wdp = t - *wdp;
>  		i_max = i;
> @@ -463,10 +457,8 @@ static void rcu_perf_async_cb(struct rcu_head *rhp)
>  		rcu_perf_wait_shutdown();
>  	} while (!torture_must_stop());
>  	if (gp_async) {
> -		rcu_perf_writer_state = RTWS_BARRIER;
>  		cur_ops->gp_barrier();
>  	}
> -	rcu_perf_writer_state = RTWS_STOPPING;
>  	writer_n_durations[me] = i_max;
>  	torture_kthread_stopping("rcu_perf_writer");
>  	return 0;
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 23:26 [PATCH tip/core/rcu 1/1] rcu: Remove unused variable rcu_perf_writer_state Ethan Hansen
2019-08-07 23:41 ` Paul E. McKenney

RCU Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/rcu/0 rcu/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 rcu rcu/ https://lore.kernel.org/rcu \
		rcu@vger.kernel.org rcu@archiver.kernel.org
	public-inbox-index rcu


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.rcu


AGPL code for this site: git clone https://public-inbox.org/ public-inbox