RE: [PATCH] cputime: Fix timeval-->cputime conversion

From: Zengtao (B)
Date: Mon Feb 01 2016 - 21:58:27 EST


> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@xxxxxxxxxxxxx]
> Sent: Monday, February 01, 2016 4:43 PM
> To: Zengtao (B)
> Cc: Arnd Bergmann; LKML; Frederic Weisbecker
> Subject: RE: [PATCH] cputime: Fix timeval-->cputime conversion
>
> On Mon, 1 Feb 2016, Zengtao (B) wrote:
>
> > Hi Arnd:
> > I have got a new idea about the problem:
> > In include/linux/time64.h
> > #define NSEC_PER_SEC 1000000000L
> > I think we should change it to
> > #define NSEC_PER_SEC 1000000000LL
> >
> > My reason is :
> > 1. when it is used in a multiplication, it will easily get overflow.
> > 2. when it don't get overflow, the change has no side affect.
>
> That's not a good idea. NSEC_PER_SEC is used in lots of places with 32bit
> storage. I really don't want to mop up all the fallout.

Yes, agree, a lot of places it has been used as 32bit value. Beyond that, I think
it is more reasonable to use 64bit.

>
> Thanks,
>
> tglx
>