From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757858Ab2FOUhV (ORCPT ); Fri, 15 Jun 2012 16:37:21 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:42581 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757602Ab2FOUhT (ORCPT ); Fri, 15 Jun 2012 16:37:19 -0400 X-Originating-IP: 217.70.178.143 X-Originating-IP: 50.43.46.74 Date: Fri, 15 Jun 2012 13:37:05 -0700 From: Josh Triplett To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, patches@linaro.org, "Paul E. McKenney" Subject: Re: [PATCH tip/core/rcu 6/6] rcu: Make rcutorture fakewriters invoke rcu_barrier() Message-ID: <20120615203705.GE31184@leaf> References: <20120615185725.GA25163@linux.vnet.ibm.com> <1339786674-25265-1-git-send-email-paulmck@linux.vnet.ibm.com> <1339786674-25265-6-git-send-email-paulmck@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1339786674-25265-6-git-send-email-paulmck@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 15, 2012 at 11:57:54AM -0700, Paul E. McKenney wrote: > From: "Paul E. McKenney" > > The current rcutorture rcu_barrier() testing never intentionally runs > more than one instance of rcu_barrier() at a given time. This fails > to test the the shiny new concurrency features of rcu_barrier(). This > commit therefore modifies the rcutorture fakewriter kthread to randomly > invoke rcu_barrier() rather than the usual synchronize_rcu(). > > Signed-off-by: Paul E. McKenney > Signed-off-by: Paul E. McKenney > --- > kernel/rcutorture.c | 6 +++++- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c > index 54a3745..dfb4e20 100644 > --- a/kernel/rcutorture.c > +++ b/kernel/rcutorture.c > @@ -1025,7 +1025,11 @@ rcu_torture_fakewriter(void *arg) > do { > schedule_timeout_uninterruptible(1 + rcu_random(&rand)%10); > udelay(rcu_random(&rand) & 0x3ff); > - cur_ops->sync(); > + if (cur_ops->cb_barrier != NULL && > + rcu_random(&rand) % (NR_CPUS * 8) == 0) NR_CPUS seems like an odd choice here. I assume you want to control for having many rcu_torture_fakewriter threads, and aim for the same average rate of barrier calls across the whole set of threads regardless of the number of threads. However, NR_CPUS does not accurately reflect either the number of fakewriter threads (which a user can set arbitrarily) or the number of CPUs currently on the system (since NR_CPUS represents the compile-time limit). I'd suggest changing this to use the actual number of fakewriter threads, which rcutorture knows at start time. - Josh Triplett