Skip to contentSkip to conversation

rcuperf: Remove unnecessary rcu_perf_writer_state variable

PATCH In review SeongJae Park 2 participants 4 messages Aug 21, 2016 – Aug 22, 2016 RCU

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 rcuperf: Remove unnecessary rcu_perf_writer_state variable

rcu_perf_writer_state is being written only while nobody reads it. This commit removes the unnecessary variable and macro constants for it.

---
 kernel/rcu/rcuperf.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
kernel/rcu/rcuperf.c +2 -14
index d38ab08..6025342 100644
@@ -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;
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/3 rcuperf: Insert space between flag and message consistently

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.

---
 kernel/rcu/rcuperf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/rcu/rcuperf.c +3 -4
index 6025342..03ba447 100644
@@ -52,7 +52,7 @@ MODULE_AUTHOR("Paul E. McKenney <[email protected]>");
 
 #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);
Signature · 1 line
1.9.1
#2 lore raw

PATCH 3/3 torture: TOROUT_STRING(): Insert a space between flag and message

In reply to SeongJae Park

TOROUT_STRING() macro function does not insert a space between flag and message while other similar couterparts do. The output will be inconsistent and weird especially when it is read by dmesg with color option enabled. This commit adds an space between flag and message in TOROUT_STRING() output.

---
 include/linux/torture.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/torture.h +1 -1
index 6685a73..a45702e 100644
@@ -43,7 +43,7 @@
 
 #define TORTURE_FLAG "-torture:"
 #define TOROUT_STRING(s) \
-	pr_alert("%s" TORTURE_FLAG s "\n", torture_type)
+	pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s)
 #define VERBOSE_TOROUT_STRING(s) \
 	do { if (verbose) pr_alert("%s" TORTURE_FLAG " %s\n", torture_type, s); } while (0)
 #define VERBOSE_TOROUT_ERRSTRING(s) \
Signature · 1 line
1.9.1
#3 lore raw
In reply to SeongJae Park
Quoted 5 lines · SeongJae Park

rcu_perf_writer_state is being written only while nobody reads it. This commit removes the unnecessary variable and macro constants for it.

---

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

Quoted 49 lines
 kernel/rcu/rcuperf.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
kernel/rcu/rcuperf.c +2 -14
index d38ab08..6025342 100644
@@ -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;
Signature · 1 line
1.9.1