rcuperf: Remove unnecessary rcu_perf_writer_state variable
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
@@ -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
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
@@ -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
PATCH 3/3 torture: TOROUT_STRING(): Insert a space between flag and message
In reply to SeongJae ParkTOROUT_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
@@ -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
Quoted 5 lines · SeongJae Park
rcu_perf_writer_stateis being written only while nobody reads it. This commit removes the unnecessary variable and macro constants for it.Signed-off-by SeongJae Park <[email protected]>---
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@@ -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