[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H4PEcCgOBL8ksjc+4LC9VPoCRBMtuGEK6ckmdJYXjdcSg@mail.gmail.com>
Date: Tue, 22 Oct 2019 10:42:55 +0800
From: Huacai Chen <chenhc@...ote.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Andy Lutomirski <luto@...nel.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
LKML <linux-kernel@...r.kernel.org>,
stable <stable@...r.kernel.org>, Arnd Bergmann <arnd@...db.de>,
Paul Burton <paul.burton@...s.com>,
"open list:MIPS" <linux-mips@...r.kernel.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 110/110] lib/vdso: Improve do_hres() and update vdso data unconditionally
Hi, Thomas,
If we use (s64)cycles < 0, then how to solve the problem that a 64bit
counter become negative?
Maybe we can change the "invalid" value from U64_MAX to 0? I think
the performance of "cycles == 0" is better than "cycles == U64_MAX".
Huacai
On Mon, Oct 21, 2019 at 10:58 PM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> On Mon, 21 Oct 2019, Thomas Gleixner wrote:
>
> > On Mon, 21 Oct 2019, Huacai Chen wrote:
> > > @@ -50,7 +50,7 @@ static int do_hres(const struct vdso_data *vd, clockid_t clk,
> > > cycles = __arch_get_hw_counter(vd->clock_mode);
> > > ns = vdso_ts->nsec;
> > > last = vd->cycle_last;
> > > - if (unlikely((s64)cycles < 0))
> > > + if (unlikely(cycles == U64_MAX))
> > > return -1;
> >
> > That used to create worse code than the weird (s64) type cast which has the
> > same effect. Did you double check that there is no change?
>
> It still does for 32bit.
Powered by blists - more mailing lists