Discussions of the Parallel Programming book
 help / color / mirror / Atom feed
* [PATCH 0/3] Polish rcutorture.h
@ 2016-08-07  3:41 SeongJae Park
  2016-08-07  3:41 ` [PATCH 1/3] rcutorture: Update usage SeongJae Park
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: SeongJae Park @ 2016-08-07  3:41 UTC (permalink / raw)
  To: paulmck; +Cc: perfbook, SeongJae Park

This patchset contains few fixups for trivial nitpicks of rcutorture.

SeongJae Park (3):
  rcutorture: Update usage
  rcutorture: Remove redundant n_read_pt initialization
  rcutorture: Protect fake workload from compiler optimization

 CodeSamples/defer/rcutorture.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
1.9.1


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

* [PATCH 1/3] rcutorture: Update usage
  2016-08-07  3:41 [PATCH 0/3] Polish rcutorture.h SeongJae Park
@ 2016-08-07  3:41 ` SeongJae Park
  2016-08-07  3:41 ` [PATCH 2/3] rcutorture: Remove redundant n_read_pt initialization SeongJae Park
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2016-08-07  3:41 UTC (permalink / raw)
  To: paulmck; +Cc: perfbook, SeongJae Park

Commit ca4aa79d18ba ("Add read-only and update-only perf test to
rcutorture.h.") and commit 5f66427aeb6b ("Fix false-sharing and
thread-affinity problems, use pthread_setspecific().") have introduced
additional arguments for additional workloads and cpustride.  However,
its usage message does not updated for them.  This commit updates
rcutorture usage message to indicate their existence.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
 CodeSamples/defer/rcutorture.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CodeSamples/defer/rcutorture.h b/CodeSamples/defer/rcutorture.h
index 3d9842f..2feb4ad 100644
--- a/CodeSamples/defer/rcutorture.h
+++ b/CodeSamples/defer/rcutorture.h
@@ -387,7 +387,8 @@ void stresstest(int nreaders)

 void usage(int argc, char *argv[])
 {
-	fprintf(stderr, "Usage: %s [nreaders [ perf | stress ] ]\n", argv[0]);
+	fprintf(stderr, "Usage: %s [nreaders [ perf | rperf | uperf | stress [cpustride] ] ]\n",
+			argv[0]);
 	exit(-1);
 }

-- 
1.9.1


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

* [PATCH 2/3] rcutorture: Remove redundant n_read_pt initialization
  2016-08-07  3:41 [PATCH 0/3] Polish rcutorture.h SeongJae Park
  2016-08-07  3:41 ` [PATCH 1/3] rcutorture: Update usage SeongJae Park
@ 2016-08-07  3:41 ` SeongJae Park
  2016-08-07  3:41 ` [PATCH 3/3] rcutorture: Protect fake workload from compiler optimization SeongJae Park
  2016-08-07 18:25 ` [PATCH 0/3] Polish rcutorture.h Paul E. McKenney
  3 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2016-08-07  3:41 UTC (permalink / raw)
  To: paulmck; +Cc: perfbook, SeongJae Park

Per-thread read count variable, n_reads_pt is redundantly initalized
inside rperftest() and uperftest() though perftestinit() do initialize
both of n_reads_pt and n_updates_pt before.  This commit removes the
redundancy.

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
 CodeSamples/defer/rcutorture.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/CodeSamples/defer/rcutorture.h b/CodeSamples/defer/rcutorture.h
index 2feb4ad..6ea0c09 100644
--- a/CodeSamples/defer/rcutorture.h
+++ b/CodeSamples/defer/rcutorture.h
@@ -213,7 +213,6 @@ void rperftest(int nreaders, int cpustride)
 	long arg;

 	perftestinit();
-	init_per_thread(n_reads_pt, 0LL);
 	for (i = 0; i < nreaders; i++) {
 		arg = (long)(i * cpustride);
 		create_thread(rcu_read_perf_test, (void *)arg);
@@ -227,7 +226,6 @@ void uperftest(int nupdaters, int cpustride)
 	long arg;

 	perftestinit();
-	init_per_thread(n_reads_pt, 0LL);
 	for (i = 0; i < nupdaters; i++) {
 		arg = (long)(i * cpustride);
 		create_thread(rcu_update_perf_test, (void *)arg);
-- 
1.9.1


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

* [PATCH 3/3] rcutorture: Protect fake workload from compiler optimization
  2016-08-07  3:41 [PATCH 0/3] Polish rcutorture.h SeongJae Park
  2016-08-07  3:41 ` [PATCH 1/3] rcutorture: Update usage SeongJae Park
  2016-08-07  3:41 ` [PATCH 2/3] rcutorture: Remove redundant n_read_pt initialization SeongJae Park
@ 2016-08-07  3:41 ` SeongJae Park
  2016-08-07 18:25 ` [PATCH 0/3] Polish rcutorture.h Paul E. McKenney
  3 siblings, 0 replies; 5+ messages in thread
From: SeongJae Park @ 2016-08-07  3:41 UTC (permalink / raw)
  To: paulmck; +Cc: perfbook, SeongJae Park

Fake workload for read-side critical section of rcutorture stress test
is implemented as a loop of hundred meaningless iterations.  However,
the loop can be optimized out by compiler because there is nothing to
avoid such optimization.  This commit protect the fake workload by using
a compiler memory barrier, ACCESS_ONCE().

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
---
 CodeSamples/defer/rcutorture.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CodeSamples/defer/rcutorture.h b/CodeSamples/defer/rcutorture.h
index 6ea0c09..c5bc87e 100644
--- a/CodeSamples/defer/rcutorture.h
+++ b/CodeSamples/defer/rcutorture.h
@@ -271,7 +271,7 @@ void *rcu_read_stress_test(void *arg)
 			n_mberror++;
 		rcu_read_lock_nest();
 		for (i = 0; i < 100; i++)
-			garbage++;
+			ACCESS_ONCE(garbage)++;
 		rcu_read_unlock_nest();
 		pc = p->pipe_count;
 		rcu_read_unlock();
-- 
1.9.1


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

* Re: [PATCH 0/3] Polish rcutorture.h
  2016-08-07  3:41 [PATCH 0/3] Polish rcutorture.h SeongJae Park
                   ` (2 preceding siblings ...)
  2016-08-07  3:41 ` [PATCH 3/3] rcutorture: Protect fake workload from compiler optimization SeongJae Park
@ 2016-08-07 18:25 ` Paul E. McKenney
  3 siblings, 0 replies; 5+ messages in thread
From: Paul E. McKenney @ 2016-08-07 18:25 UTC (permalink / raw)
  To: SeongJae Park; +Cc: perfbook

On Sun, Aug 07, 2016 at 12:41:24PM +0900, SeongJae Park wrote:
> This patchset contains few fixups for trivial nitpicks of rcutorture.

Good catches, applied and pushed.

								Thanx, Paul

> SeongJae Park (3):
>   rcutorture: Update usage
>   rcutorture: Remove redundant n_read_pt initialization
>   rcutorture: Protect fake workload from compiler optimization
> 
>  CodeSamples/defer/rcutorture.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> -- 
> 1.9.1
> 


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

end of thread, other threads:[~2016-08-07 18:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-07  3:41 [PATCH 0/3] Polish rcutorture.h SeongJae Park
2016-08-07  3:41 ` [PATCH 1/3] rcutorture: Update usage SeongJae Park
2016-08-07  3:41 ` [PATCH 2/3] rcutorture: Remove redundant n_read_pt initialization SeongJae Park
2016-08-07  3:41 ` [PATCH 3/3] rcutorture: Protect fake workload from compiler optimization SeongJae Park
2016-08-07 18:25 ` [PATCH 0/3] Polish rcutorture.h Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox