Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1466941 > unrolled thread

[PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable

Started bySeongJae Park <sj38.park@gmail.com>
First post2016-08-21 10:00 +0200
Last post2016-08-22 02:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable SeongJae Park <sj38.park@gmail.com> - 2016-08-21 10:00 +0200
    [PATCH 2/3] rcuperf: Insert space between flag and message consistently SeongJae Park <sj38.park@gmail.com> - 2016-08-21 10:00 +0200
    Re: [PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state  variable "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-08-22 02:20 +0200

#1466941 — [PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable

FromSeongJae Park <sj38.park@gmail.com>
Date2016-08-21 10:00 +0200
Subject[PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable
Message-ID<s8vPI-5WQ-9@gated-at.bofh.it>
rcu_perf_writer_state is being written only while nobody reads it.  This
commit removes the unnecessary variable and macro constants for it.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
 kernel/rcu/rcuperf.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index d38ab08..6025342 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -86,13 +86,6 @@ static u64 t_rcu_perf_writer_finished;
 static unsigned long b_rcu_perf_writer_started;
 static unsigned long b_rcu_perf_writer_finished;
 
-static int rcu_perf_writer_state;
-#define RTWS_INIT		0
-#define RTWS_EXP_SYNC		1
-#define RTWS_SYNC		2
-#define RTWS_IDLE		2
-#define RTWS_STOPPING		3
-
 #define MAX_MEAS 10000
 #define MIN_MEAS 100
 
@@ -381,14 +374,10 @@ rcu_perf_writer(void *arg)
 	do {
 		wdp = &wdpp[i];
 		*wdp = ktime_get_mono_fast_ns();
-		if (gp_exp) {
-			rcu_perf_writer_state = RTWS_EXP_SYNC;
+		if (gp_exp)
 			cur_ops->exp_sync();
-		} else {
-			rcu_perf_writer_state = RTWS_SYNC;
+		else
 			cur_ops->sync();
-		}
-		rcu_perf_writer_state = RTWS_IDLE;
 		t = ktime_get_mono_fast_ns();
 		*wdp = t - *wdp;
 		i_max = i;
@@ -429,7 +418,6 @@ rcu_perf_writer(void *arg)
 			i++;
 		rcu_perf_wait_shutdown();
 	} while (!torture_must_stop());
-	rcu_perf_writer_state = RTWS_STOPPING;
 	writer_n_durations[me] = i_max;
 	torture_kthread_stopping("rcu_perf_writer");
 	return 0;
-- 
1.9.1

[toc] | [next] | [standalone]


#1466943 — [PATCH 2/3] rcuperf: Insert space between flag and message consistently

FromSeongJae Park <sj38.park@gmail.com>
Date2016-08-21 10:00 +0200
Subject[PATCH 2/3] rcuperf: Insert space between flag and message consistently
Message-ID<s8vPI-5WQ-11@gated-at.bofh.it>
In reply to#1466941
Few output messages of rcuperf has no space between flag and start of
message while every other messages keeps a space consistently.  It makes
output messages to be inconsistent and weird especially when it be read
by dmesg with color option enabled.  This commit fixes the problem by
modifying a pr_alert() call and PERFOUT_STRING() macro function.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
 kernel/rcu/rcuperf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
index 6025342..03ba447 100644
--- a/kernel/rcu/rcuperf.c
+++ b/kernel/rcu/rcuperf.c
@@ -52,7 +52,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@linux.vnet.ibm.com>");
 
 #define PERF_FLAG "-perf:"
 #define PERFOUT_STRING(s) \
-	pr_alert("%s" PERF_FLAG s "\n", perf_type)
+	pr_alert("%s" PERF_FLAG " %s\n", perf_type, s)
 #define VERBOSE_PERFOUT_STRING(s) \
 	do { if (verbose) pr_alert("%s" PERF_FLAG " %s\n", perf_type, s); } while (0)
 #define VERBOSE_PERFOUT_ERRSTRING(s) \
@@ -389,9 +389,8 @@ rcu_perf_writer(void *arg)
 			sp.sched_priority = 0;
 			sched_setscheduler_nocheck(current,
 						   SCHED_NORMAL, &sp);
-			pr_alert("%s" PERF_FLAG
-				 "rcu_perf_writer %ld has %d measurements\n",
-				 perf_type, me, MIN_MEAS);
+			pr_alert("%s%s rcu_perf_writer %ld has %d measurements\n",
+				 perf_type, PERF_FLAG, me, MIN_MEAS);
 			if (atomic_inc_return(&n_rcu_perf_writer_finished) >=
 			    nrealwriters) {
 				schedule_timeout_interruptible(10);
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1467291 — Re: [PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable

From"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date2016-08-22 02:20 +0200
SubjectRe: [PATCH 1/3] rcuperf: Remove unnecessary rcu_perf_writer_state variable
Message-ID<s8L85-7kP-1@gated-at.bofh.it>
In reply to#1466941
On Sun, Aug 21, 2016 at 04:54:38PM +0900, SeongJae Park wrote:
> rcu_perf_writer_state is being written only while nobody reads it.  This
> commit removes the unnecessary variable and macro constants for it.
> 
> Signed-off-by: SeongJae Park <sj38.park@gmail.com>
> ---

I am keeping rcu_perf_writer_state for debugging purposes, but I pulled
in the other two patches for review and testing, thank you!

							Thanx, Paul

>  kernel/rcu/rcuperf.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c
> index d38ab08..6025342 100644
> --- a/kernel/rcu/rcuperf.c
> +++ b/kernel/rcu/rcuperf.c
> @@ -86,13 +86,6 @@ static u64 t_rcu_perf_writer_finished;
>  static unsigned long b_rcu_perf_writer_started;
>  static unsigned long b_rcu_perf_writer_finished;
> 
> -static int rcu_perf_writer_state;
> -#define RTWS_INIT		0
> -#define RTWS_EXP_SYNC		1
> -#define RTWS_SYNC		2
> -#define RTWS_IDLE		2
> -#define RTWS_STOPPING		3
> -
>  #define MAX_MEAS 10000
>  #define MIN_MEAS 100
> 
> @@ -381,14 +374,10 @@ rcu_perf_writer(void *arg)
>  	do {
>  		wdp = &wdpp[i];
>  		*wdp = ktime_get_mono_fast_ns();
> -		if (gp_exp) {
> -			rcu_perf_writer_state = RTWS_EXP_SYNC;
> +		if (gp_exp)
>  			cur_ops->exp_sync();
> -		} else {
> -			rcu_perf_writer_state = RTWS_SYNC;
> +		else
>  			cur_ops->sync();
> -		}
> -		rcu_perf_writer_state = RTWS_IDLE;
>  		t = ktime_get_mono_fast_ns();
>  		*wdp = t - *wdp;
>  		i_max = i;
> @@ -429,7 +418,6 @@ rcu_perf_writer(void *arg)
>  			i++;
>  		rcu_perf_wait_shutdown();
>  	} while (!torture_must_stop());
> -	rcu_perf_writer_state = RTWS_STOPPING;
>  	writer_n_durations[me] = i_max;
>  	torture_kthread_stopping("rcu_perf_writer");
>  	return 0;
> -- 
> 1.9.1
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web