Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbbBSTQH (ORCPT ); Thu, 19 Feb 2015 14:16:07 -0500 Received: from mail-wi0-f176.google.com ([209.85.212.176]:41843 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939AbbBSTQF (ORCPT ); Thu, 19 Feb 2015 14:16:05 -0500 Date: Thu, 19 Feb 2015 20:16:01 +0100 From: Ingo Molnar To: John Stultz Cc: Nishanth Aravamudan , Thomas Gleixner , lkml , jstancek@redhat.com Subject: Re: time / gtod seconds value out of sync? Message-ID: <20150219191601.GA12224@gmail.com> References: <20150219183531.GA13745@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1435 Lines: 42 * John Stultz wrote: > > [ 313.001823] NACC: timekeeping_get_ns = 1000121642 > > [ 314.001889] NACC: timekeeping_get_ns = 188401 > > > > gtod correctly accumulates those nsecs into the secs value: > > > > ts->tv_sec = tk->xtime_sec; > > nsecs = timekeeping_get_ns(&tk->tkr); > > ts->tv_nsec = 0; > > timespec64_add_ns(ts, nsecs); > > > > but time() does: > > > > return tk->xtime_sec; > > > > It seems like overkill to do the full timekeeping_get_ns() in time(), > > Right, so looking into the git history, > f20bf6125605acbbc7eb8c9420d7221c91aa83eb (time: introduce > xtime_seconds) changed this specifically for performance > reasons (cc'ed Ingo here, in case he remembers more > context). > > The idea that time() would be ok as being HZ granular, > and its been this way since 2.6.23. Thus you have a < HZ > sized window where gettimeofday() will return the next > second before time() gets updated by the tick. Yes, and the scalability advantage is significant if you have an app that calls time() often. Undoing that would certainly make me sad. Thanks, Ingo -- 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/