From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765645AbYDQBQO (ORCPT ); Wed, 16 Apr 2008 21:16:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753709AbYDQBHo (ORCPT ); Wed, 16 Apr 2008 21:07:44 -0400 Received: from sous-sol.org ([216.99.217.87]:58868 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757637AbYDQBHk (ORCPT ); Wed, 16 Apr 2008 21:07:40 -0400 Message-Id: <20080417010205.251905099@sous-sol.org> References: <20080417010122.148289106@sous-sol.org> User-Agent: quilt/0.46-1 Date: Wed, 16 Apr 2008 18:01:23 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Segher Boessenkool , john stultz , Ingo Molnar , Thomas Gleixner , Sedat Dilek Subject: time: prevent the loop in timespec_add_ns() from being optimised away Content-Disposition: inline; filename=time-prevent-the-loop-in-timespec_add_ns-from-being-optimised-away.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -stable review patch. If anyone has any objections, please let us know. --------------------- From: Segher Boessenkool upstream commit: 38332cb98772f5ea757e6486bed7ed0381cb5f98 Since some architectures don't support __udivdi3(). Signed-off-by: Segher Boessenkool Cc: john stultz Cc: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Thomas Gleixner Cc: Sedat Dilek Signed-off-by: Chris Wright --- include/linux/time.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/include/linux/time.h +++ b/include/linux/time.h @@ -173,6 +173,10 @@ static inline void timespec_add_ns(struc { ns += a->tv_nsec; while(unlikely(ns >= NSEC_PER_SEC)) { + /* The following asm() prevents the compiler from + * optimising this loop into a modulo operation. */ + asm("" : "+r"(ns)); + ns -= NSEC_PER_SEC; a->tv_sec++; } --