1. 02 May, 2008 1 commit
    • H. Peter Anvin's avatar
      Make constants in kernel/timeconst.h fixed 64 bits · b9095fd8
      H. Peter Anvin authored
      
      Force constants in kernel/timeconst.h (except shift counts) to be 64 bits,
      using U64_C() constructor macros, and eliminate constants that cannot
      be represented at all in 64 bits.  This avoids warnings with some gcc
      versions.
      
      Drop generating 64-bit constants, since we have no real hope of
      getting a full set (operation on 64-bit values requires a 128-bit
      intermediate result, which gcc only supports on 64-bit platforms, and
      only with libgcc support on some.)  Note that the use of these
      constants does not depend on if we are on a 32- or 64-bit architecture.
      
      This resolves Bugzilla 10153.
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      b9095fd8
  2. 01 May, 2008 2 commits
  3. 29 Apr, 2008 1 commit
  4. 21 Apr, 2008 1 commit
  5. 08 Feb, 2008 2 commits
    • H. Peter Anvin's avatar
      avoid overflows in kernel/time.c · bdc80787
      H. Peter Anvin authored
      
      When the conversion factor between jiffies and milli- or microseconds is
      not a single multiply or divide, as for the case of HZ == 300, we currently
      do a multiply followed by a divide.  The intervening result, however, is
      subject to overflows, especially since the fraction is not simplified (for
      HZ == 300, we multiply by 300 and divide by 1000).
      
      This is exposed to the user when passing a large timeout to poll(), for
      example.
      
      This patch replaces the multiply-divide with a reciprocal multiplication on
      32-bit platforms.  When the input is an unsigned long, there is no portable
      way to do this on 64-bit platforms there is no portable way to do this
      since it requires a 128-bit intermediate result (which gcc does support on
      64-bit platforms but may generate libgcc calls, e.g.  on 64-bit s390), but
      since the output is a 32-bit integer in the cases affected, just simplify
      the multiply-divide (*3/10 instead of *300/1000).
      
      The reciprocal multiply used can have off-by-one errors in the upper half
      of the valid output range.  This could be avoided at the expense of having
      to deal with a potential 65-bit intermediate result.  Since the intent is
      to avoid overflow problems and most of the other time conversions are only
      semiexact, the off-by-one errors were considered an acceptable tradeoff.
      
      At Ralf Baechle's suggestion, this version uses a Perl script to compute
      the necessary constants.  We already have dependencies on Perl for kernel
      compiles.  This does, however, require the Perl module Math::BigInt, which
      is included in the standard Perl distribution starting with version 5.8.0.
      In order to support older versions of Perl, include a table of canned
      constants in the script itself, and structure the script so that
      Math::BigInt isn't required if pulling values from said table.
      
      Running the script requires that the HZ value is available from the
      Makefile.  Thus, this patch also adds the Kconfig variable CONFIG_HZ to the
      architectures which didn't already have it (alpha, cris, frv, h8300, m32r,
      m68k, m68knommu, sparc, v850, and xtensa.) It does *not* touch the sh or
      sh64 architectures, since Paul Mundt has dealt with those separately in the
      sh tree.
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>,
      Cc: Sam Ravnborg <sam@ravnborg.org>,
      Cc: Paul Mundt <lethal@linux-sh.org>,
      Cc: Richard Henderson <rth@twiddle.net>,
      Cc: Michael Starvik <starvik@axis.com>,
      Cc: David Howells <dhowells@redhat.com>,
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
      Cc: Hirokazu Takata <takata@linux-m32r.org>,
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
      Cc: Roman Zippel <zippel@linux-m68k.org>,
      Cc: William L. Irwin <sparclinux@vger.kernel.org>,
      Cc: Chris Zankel <chris@zankel.net>,
      Cc: H. Peter Anvin <hpa@zytor.com>,
      Cc: Jan Engelhardt <jengelh@computergmbh.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bdc80787
    • Li Zefan's avatar
      time: fix typo in comments · 3eb05676
      Li Zefan authored
      
      Fix typo in comments.
      
      BTW: I have to fix coding style in arch/ia64/kernel/time.c also, otherwise
      checkpatch.pl will be complaining.
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: john stultz <johnstul@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3eb05676
  6. 06 Feb, 2008 2 commits
  7. 01 Feb, 2008 1 commit
  8. 18 Oct, 2007 2 commits
  9. 17 Oct, 2007 1 commit
  10. 16 Oct, 2007 1 commit
    • Ingo Molnar's avatar
      time: introduce xtime_seconds · f20bf612
      Ingo Molnar authored
      
      improve performance of sys_time(). sys_time() returns time in seconds,
      but it does so by calling do_gettimeofday() and then returning the
      tv_sec portion of the GTOD time. But the data structure "xtime", which
      is updated by every timer/scheduler tick, already offers HZ granularity
      time.
      
      the patch improves the sysbench oltp macrobenchmark by 4-5% on an AMD
      dual-core system:
      
      v2.6.23:
      
      #threads
      
         1:     transactions:                        4073   (407.23 per sec.)
         2:     transactions:                        8530   (852.81 per sec.)
         3:     transactions:                        8321   (831.88 per sec.)
         4:     transactions:                        8407   (840.58 per sec.)
         5:     transactions:                        8070   (806.74 per sec.)
      
      v2.6.23 + sys_time-speedup.patch:
      
         1:     transactions:                        4281   (428.09 per sec.)
         2:     transactions:                        8910   (890.85 per sec.)
         3:     transactions:                        8659   (865.79 per sec.)
         4:     transactions:                        8676   (867.34 per sec.)
         5:     transactions:                        8532   (852.91 per sec.)
      
      and by 4-5% on an Intel dual-core system too:
      
      2.6.23:
      
        1:     transactions:                        4560   (455.94 per sec.)
        2:     transactions:                        10094  (1009.30 per sec.)
        3:     transactions:                        9755   (975.36 per sec.)
        4:     transactions:                        9859   (985.78 per sec.)
        5:     transactions:                        9701   (969.72 per sec.)
      
      2.6.23 + sys_time-speedup.patch:
      
        1:     transactions:                        4779   (477.84 per sec.)
        2:     transactions:                        10103  (1010.14 per sec.)
        3:     transactions:                        10141  (1013.93 per sec.)
        4:     transactions:                        10371  (1036.89 per sec.)
        5:     transactions:                        10178  (1017.50 per sec.)
      
      (the more CPUs the system has, the more speedup this patch gives for
      this particular workload.)
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f20bf612
  11. 25 Jul, 2007 1 commit
    • john stultz's avatar
      Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time(). · 2c6b47de
      john stultz authored
      
      This avoids use of the kernel-internal "xtime" variable directly outside
      of the actual time-related functions.  Instead, use the helper functions
      that we already have available to us.
      
      This doesn't actually change any behaviour, but this will allow us to
      fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ
      (because much of the realtime information is maintained as separate
      offsets to 'xtime'), which has caused interfaces that use xtime directly
      to get a time that is out of sync with the real-time clock by up to a
      third of a second or so.
      Signed-off-by: default avatarJohn Stultz <johnstul@us.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2c6b47de
  12. 20 Jul, 2007 2 commits
    • Linus Torvalds's avatar
      Revert "sys_time() speedup" · 20082208
      Linus Torvalds authored
      This basically reverts commit 4e44f349
      
      ,
      while waiting for it to be re-done more completely.  There are cases of
      people mixing "time()" with higher-resolution time sources, and we need
      to take the nanosecond offsets into account.
      
      Ingo has a patch that does that, but it's still under some discussion.
      In the meantime, just revert back to the old simple situation of just
      doing the whole exact timesource calculations.
      
      But rather than using do_gettimeofday(), use the internal nanosecond
      resolution getnstimeofday(), which at least avoids one unnecessary
      conversion (since we really don't care about whether the fractional
      seconds are nanoseconds or microseconds - we'll just throw them away).
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      20082208
    • Bob Picco's avatar
      [IA64] remove time interpolator · 1f564ad6
      Bob Picco authored
      
      Remove time_interpolator code (This is generic code, but
      only user was ia64.  It has been superseded by the
      CONFIG_GENERIC_TIME code).
      Signed-off-by: default avatarBob Picco <bob.picco@hp.com>
      Signed-off-by: default avatarJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: default avatarPeter Keilty <peter.keilty@hp.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      1f564ad6
  13. 16 Jul, 2007 1 commit
    • Ingo Molnar's avatar
      sys_time() speedup · 4e44f349
      Ingo Molnar authored
      
      Improve performance of sys_time().  sys_time() returns time in seconds, but
      it does so by calling do_gettimeofday() and then returning the tv_sec
      portion of the GTOD time.  But the data structure "xtime", which is updated
      by every timer/scheduler tick, already offers HZ granularity time.
      
      The patch improves the sysbench OLTP macrobenchmark significantly:
      
      2.6.22-rc6:
      
      #threads
         1:        transactions:                        3733   (373.21 per sec.)
         2:        transactions:                        6676   (667.46 per sec.)
         3:        transactions:                        6957   (695.50 per sec.)
         4:        transactions:                        7055   (705.48 per sec.)
         5:        transactions:                        6596   (659.33 per sec.)
      
      2.6.22-rc6 + sys_time.patch:
      
         1:        transactions:                        4005   (400.47 per sec.)
         2:        transactions:                        7379   (737.77 per sec.)
         3:        transactions:                        7347   (734.49 per sec.)
         4:        transactions:                        7468   (746.65 per sec.)
         5:        transactions:                        7428   (742.47 per sec.)
      
      Mixed API uses of gettimeofday() and time() are guaranteed to be coherent
      via the use of a at-most-once-per-second slowpath that updates xtime.
      
      [akpm@linux-foundation.org: build fixes]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Roman Zippel <zippel@linux-m68k.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4e44f349
  14. 08 May, 2007 2 commits
  15. 26 Apr, 2007 2 commits
    • Stephen Hemminger's avatar
      [TCP] tcp_probe: improvements for net-2.6.22 · 85795d64
      Stephen Hemminger authored
      
      Change tcp_probe to use ktime (needed to add one export).
      Add option to only get events when cwnd changes - from Doug Leith
      Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85795d64
    • Eric Dumazet's avatar
      [NET]: convert network timestamps to ktime_t · b7aa0bf7
      Eric Dumazet authored
      
      We currently use a special structure (struct skb_timeval) and plain
      'struct timeval' to store packet timestamps in sk_buffs and struct
      sock.
      
      This has some drawbacks :
      - Fixed resolution of micro second.
      - Waste of space on 64bit platforms where sizeof(struct timeval)=16
      
      I suggest using ktime_t that is a nice abstraction of high resolution
      time services, currently capable of nanosecond resolution.
      
      As sizeof(ktime_t) is 8 bytes, using ktime_t in 'struct sock' permits
      a 8 byte shrink of this structure on 64bit architectures. Some other
      structures also benefit from this size reduction (struct ipq in
      ipv4/ip_fragment.c, struct frag_queue in ipv6/reassembly.c, ...)
      
      Once this ktime infrastructure adopted, we can more easily provide
      nanosecond resolution on top of it. (ioctl SIOCGSTAMPNS and/or
      SO_TIMESTAMPNS/SCM_TIMESTAMPNS)
      
      Note : this patch includes a bug correction in
      compat_sock_get_timestamp() where a "err = 0;" was missing (so this
      syscall returned -ENOENT instead of 0)
      Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
      CC: Stephen Hemminger <shemminger@linux-foundation.org>
      CC: John find <linux.kernel@free.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7aa0bf7
  16. 04 Apr, 2007 1 commit
  17. 16 Feb, 2007 2 commits
  18. 01 Oct, 2006 1 commit
  19. 26 Jun, 2006 1 commit
  20. 31 Mar, 2006 1 commit
    • Kalin KOZHUHAROV's avatar
      Fix comments: s/granuality/granularity/ · 8ba8e95e
      Kalin KOZHUHAROV authored
      
      I was grepping through the code and some `grep ganularity -R .` didn't
      catch what I thought. Then looking closer I saw the term "granuality"
      used in only four places (in comments) and granularity in many more
      places describing the same idea. Some other facts:
      
      dictionary.com does not know such a word
      define:granuality on google is not found (and pages for granuality are
      mostly related to patches to the kernel)
      it has not been discussed as a term on LKML, AFAICS (=Can Search)
      
      To be consistent, I think granularity should be used everywhere.
      Signed-off-by: default avatarKalin KOZHUHAROV <kalin@thinrope.net>
      Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
      8ba8e95e
  21. 26 Mar, 2006 1 commit
  22. 25 Mar, 2006 1 commit
  23. 03 Feb, 2006 1 commit
  24. 31 Jan, 2006 1 commit
  25. 11 Jan, 2006 1 commit
  26. 10 Jan, 2006 6 commits
  27. 12 Dec, 2005 1 commit
    • Matt Helsley's avatar
      [PATCH] Add getnstimestamp function · 64123fd4
      Matt Helsley authored
      
      There are several functions that might seem appropriate for a timestamp:
      
      get_cycles()
      current_kernel_time()
      do_gettimeofday()
      <read jiffies/jiffies_64>
      
      Each has problems with combinations of SMP-safety, low resolution, and
      monotonicity. This patch adds a new function that returns a monotonic SMP-safe
      timestamp with nanosecond resolution where available.
      
      Changes:
      	Split timestamp into separate patch
      	Moved to kernel/time.c
      	Renamed to getnstimestamp
      	Fixed unintended-pointer-arithmetic bug
      Signed-off-by: default avatarMatt Helsley <matthltc@us.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      64123fd4