[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200530124703.GJ2869@paulmck-ThinkPad-P72>
Date: Sat, 30 May 2020 05:47:03 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Nathan Chancellor <natechancellor@...il.com>,
Josh Triplett <josh@...htriplett.org>,
"Joel Fernandes (Google)" <joel@...lfernandes.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Stephen Rothwell <sfr@...b.auug.org.au>, rcu@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] refperf: work around 64-bit division
On Sat, May 30, 2020 at 10:01:36AM +0200, Arnd Bergmann wrote:
> On Sat, May 30, 2020 at 5:52 AM Nathan Chancellor
> <natechancellor@...il.com> wrote:
> > On Fri, May 29, 2020 at 10:15:51PM +0200, Arnd Bergmann wrote:
> > > strcat(buf, "Threads\tTime(ns)\n");
> > >
> > > for (exp = 0; exp < nruns; exp++) {
> > > + u64 avg;
> > > + u32 rem;
> > > +
> > > if (errexit)
> > > break;
> > > - sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, result_avg[exp] / 1000, (int)(result_avg[exp] % 1000));
> > > +
> > > + avg = div_s64_rem(result_avg[exp], 1000, &rem);
> >
> > Shouldn't this be div_u64_rem? result_avg is u64.
>
> Yes, you are right. Actually that would be an important optimization
> since div_u64_rem() optimizes for constant divisors while div_s64_rem
> uses the slow path.
>
> > > + sprintf(buf1, "%d\t%llu.%03d\n", exp + 1, avg, rem);
> >
> > Would %03u be the better specifier since rem is u32?
>
> Yes, though this makes no difference in practice.
>
> Paul, should I send a fixup for these two, or do you prefer to just
> edit it in place?
I will apply it with Randy's Ack, thank you all!
Thanx, Paul
Powered by blists - more mailing lists