[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hzhbybbnu.wl-tiwai@suse.de>
Date: Mon, 30 Mar 2020 08:27:01 +0200
From: Takashi Iwai <tiwai@...e.de>
To: James Bottomley <James.Bottomley@...senPartnership.com>
Cc: George Spelvin <lkml@....ORG>, linux-kernel@...r.kernel.org,
Hannes Reinecke <hare@...e.de>, linux-scsi@...r.kernel.org,
Marek Lindner <mareklindner@...mailbox.ch>,
Simon Wunderlich <sw@...onwunderlich.de>,
Antonio Quartulli <a@...table.cc>,
Sven Eckelmann <sven@...fation.org>,
b.a.t.m.a.n@...tynna.open-mesh.org,
Johannes Berg <johannes@...solutions.net>,
linux-wireless@...r.kernel.org, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org
Subject: Re: [RFC PATCH v1 13/50] Avoid some useless msecs/jiffies conversions
On Sun, 29 Mar 2020 20:16:47 +0200,
James Bottomley wrote:
>
> On Sun, 2020-03-29 at 17:50 +0000, George Spelvin wrote:
> > On Sun, Mar 29, 2020 at 07:13:33PM +0200, Takashi Iwai wrote:
> > > On Sun, 29 Mar 2020 14:11:29 +0200, George Spelvin wrote:
> > > > On Sun, Mar 29, 2020 at 09:52:23AM +0200, Takashi Iwai wrote:
> > > > > I thought the compiler already optimizes to the constant
> > > > > calculation
> > > > > for the above case?
> > > >
> > > > It optimizes that if the entire argument, including "seconds", is
> > > > a compile-time constant.
> > > >
> > > > However, given "msecs_to_jiffies(hdev->rpa_timeout * 1000);",
> > > > the computatin is non-trivial.
> > >
> > > Fair enough. But it's still a question whether an open code X * HZ
> > > is
> > > good at all...
> >
> > I'm sorry, I don't understand what you mean by "good at all" here.
> > The value computed is exactly the same.
>
> I think he means what the compiler does with it.
>
> We all assume that msecs_to_jiffies is properly optimized so there
> should be no need to open code it like you're proposing.
Yes, it'd be best if the compiler can handle it properly.
But also I meant to keep using the macro for consistency reason.
IIRC, we wanted to eliminate the explicit use of HZ in the past, and
it's how many lines have been converted with *_to_jiffies() calls.
I don't know whether the eliminate of HZ is still wished, but
reverting to the open code is a step backward for that.
thanks,
Takashi
Powered by blists - more mailing lists