Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 1 Nov 2001 06:22:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 1 Nov 2001 06:22:30 -0500 Received: from gateway-1237.mvista.com ([12.44.186.158]:32756 "EHLO hermes.mvista.com") by vger.kernel.org with ESMTP id ; Thu, 1 Nov 2001 06:22:23 -0500 Message-ID: <3BE13035.30AC3E3D@mvista.com> Date: Thu, 01 Nov 2001 03:21:25 -0800 From: george anzinger Organization: Monta Vista Software X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.12-20b i686) X-Accept-Language: en MIME-Version: 1.0 To: Tim Schmielau CC: Andreas Dilger , linux-kernel@vger.kernel.org, J Sloan Subject: Re: [Patch] Re: Nasty suprise with uptime In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Tim Schmielau wrote: ~snip > @@ -683,6 +683,34 @@ > if (TQ_ACTIVE(tq_timer)) > mark_bh(TQUEUE_BH); > } > + > + > +#if BITS_PER_LONG < 48 > + > +u64 get_jiffies64(void) > +{ > + static unsigned long jiffies_hi = 0; > + static unsigned long jiffies_last = INITIAL_JIFFIES; > + unsigned long jiffies_tmp; > + > + jiffies_tmp = jiffies; /* avoid races */ > + if (jiffies_tmp < jiffies_last) /* We have a wrap */ > + jiffies_hi++; > + jiffies_last = jiffies_tmp; > + > + return (jiffies_tmp | ((u64)jiffies_hi) << BITS_PER_LONG); Doesn't this need to be protected on SMP machines? What if two cpus call get_jiffies64() at the same time... Seems like jiffies_hi could get bumped twice instead of once. George - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/