From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428AbcHVLtl (ORCPT ); Mon, 22 Aug 2016 07:49:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51247 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751032AbcHVLtj (ORCPT ); Mon, 22 Aug 2016 07:49:39 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com Date: Mon, 22 Aug 2016 04:49:43 -0700 From: "Paul E. McKenney" To: Nicholas Mc Guire Cc: Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] rcuperf: make timeout HZ independent Reply-To: paulmck@linux.vnet.ibm.com References: <1471864865-28040-1-git-send-email-hofrat@osadl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1471864865-28040-1-git-send-email-hofrat@osadl.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082211-8235-0000-0000-000009088289 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005628; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000183; SDB=6.00748049; UDB=6.00352993; IPR=6.00520711; BA=6.00004672; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012417; XFM=3.00000011; UTC=2016-08-22 11:49:36 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082211-8236-0000-0000-000034294BA7 Message-Id: <20160822114943.GY3482@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-22_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608220126 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 22, 2016 at 01:21:05PM +0200, Nicholas Mc Guire wrote: > Make the probability of ftrace dump not interfering with other writers > grace period, HZ independent. > > Signed-off-by: Nicholas Mc Guire What we would -really- like is to vary the time based on the clock rate of the CPUs (could use bogomips, I suppose) and the memory latency of the system, so that systems with smaller memory latency and faster CPUs would use shorter timeouts. However, slower CPUs tend to use smaller HZ values, so varying based on HZ is not entirely insane. But what would you suggest? Good question on schedule_timeout_interruptible()... I usually do that if there is some reason to be sensitive to an early wakeup, for example, to allow shutdown to proceed quickly, but that doesn't make much sense here, given that ftrace_dump() is likely to take a very long time. Thanx, Paul > --- > > Problem found by coccinelle script > > Passing in jiffies as value allows for this "fixed" delay varying by > one order of magnitude. As it is intended to reduce the probability of > interference this probability should not be dependent on the systems > HZ setting. Its probably more cosmetic but I guess this is the cleaner > way for fixed delays. > > Q: Could not really figure out why the _interruptible_ version is used > here - I would assume that schedule_timeout() would be what is needed > here, as this should simply be a fixed delay. > > Patch was compile tested with: x86_64_defconfig + CONFIG_RCU_PERF_TEST=m > > Patch is against 4.8.0-rc2 (localversion-next is -next-20160822) > > kernel/rcu/rcuperf.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c > index 123ccbd..4cd8655 100644 > --- a/kernel/rcu/rcuperf.c > +++ b/kernel/rcu/rcuperf.c > @@ -404,7 +404,8 @@ rcu_perf_writer(void *arg) > perf_type, PERF_FLAG, me, MIN_MEAS); > if (atomic_inc_return(&n_rcu_perf_writer_finished) >= > nrealwriters) { > - schedule_timeout_interruptible(10); > + schedule_timeout_interruptible( > + msecs_to_jiffies(10)); > rcu_ftrace_dump(DUMP_ALL); > PERFOUT_STRING("Test complete"); > t_rcu_perf_writer_finished = t; > -- > 2.1.4 >