On Fri, 28 Nov 2014 19:23:33 +0100 Frederic Weisbecker <fweis...@gmail.com> wrote:
> This will be needed for the conversion of kernel stat to nsecs. > > Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> > Cc: Heiko Carstens <heiko.carst...@de.ibm.com> > Cc: Ingo Molnar <mi...@kernel.org> > Cc: Martin Schwidefsky <schwidef...@de.ibm.com> > Cc: Oleg Nesterov <o...@redhat.com> > Cc: Paul Mackerras <pau...@samba.org> > Cc: Peter Zijlstra <pet...@infradead.org> > Cc: Rik van Riel <r...@redhat.com> > Cc: Thomas Gleixner <t...@linutronix.de> > Cc: Tony Luck <tony.l...@intel.com> > Cc: Wu Fengguang <fengguang...@intel.com> > Signed-off-by: Frederic Weisbecker <fweis...@gmail.com> > --- > include/linux/cputime.h | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/include/linux/cputime.h b/include/linux/cputime.h > index f2eb2ee..a225ab9 100644 > --- a/include/linux/cputime.h > +++ b/include/linux/cputime.h > @@ -13,4 +13,14 @@ > usecs_to_cputime((__nsecs) / NSEC_PER_USEC) > #endif > > +#ifndef nsecs_to_cputime > +# define nsecs_to_cputime(__nsecs) \ > + usecs_to_cputime((__nsecs) / NSEC_PER_USEC) > +#endif > + > +#ifndef nsecs_to_cputime64 > +# define nsecs_to_cputime64(__nsecs) \ > + ((__force cputime64_t) nsecs_to_cputime(__nsecs)) > +#endif > + > #endif /* __LINUX_CPUTIME_H */ For any architecture with a cputime_t better than a micro-second the conversion to micro seconds degrades the precision a lot. I would prefer to see the compile fail for e.g. s390 instead of silently introducing *broken* cputime values. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/