1. 26 11月, 2009 1 次提交
    • H
      sched, time: Define nsecs_to_jiffies() · b7b20df9
      Hidetoshi Seto 提交于
      Use of msecs_to_jiffies() for nsecs_to_cputime() have some
      problems:
      
       - The type of msecs_to_jiffies()'s argument is unsigned int, so
         it cannot convert msecs greater than UINT_MAX = about 49.7 days.
      
       - msecs_to_jiffies() returns MAX_JIFFY_OFFSET if MSB of argument
         is set, assuming that input was negative value.  So it cannot
         convert msecs greater than INT_MAX = about 24.8 days too.
      
      This patch defines a new function nsecs_to_jiffies() that can
      deal greater values, and that can deal all incoming values as
      unsigned.
      Signed-off-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Stanislaw Gruszka <sgruszka@redhat.com>
      Cc: Spencer Candland <spencer@bluehost.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Cc: Amrico Wang <xiyou.wangcong@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Stultz <johnstul@linux.vnet.ibm.com>
      LKML-Reference: <4B0E16E7.5070307@jp.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b7b20df9
  2. 05 10月, 2009 1 次提交
    • J
      time: Remove xtime_cache · 7bc7d637
      john stultz 提交于
      With the prior logarithmic time accumulation patch, xtime will now
      always be within one "tick" of the current time, instead of
      possibly half a second off.
      
      This removes the need for the xtime_cache value, which always
      stored the time at the last interrupt, so this patch cleans that up
      removing the xtime_cache related code.
      
      This is a bit simpler, but still could use some wider testing.
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NJohn Kacur <jkacur@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <1254525855.7741.95.camel@localhost.localdomain>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      7bc7d637
  3. 15 9月, 2009 1 次提交
    • T
      time: Prevent 32 bit overflow with set_normalized_timespec() · 12e09337
      Thomas Gleixner 提交于
      set_normalized_timespec() nsec argument is of type long. The recent
      timekeeping changes of ktime_get_ts() feed 
      
      	ts->tv_nsec + tomono.tv_nsec + nsecs
      
      to set_normalized_timespec(). On 32 bit machines that sum can be
      larger than (1 << 31) and therefor result in a negative value which
      screws up the result completely.
      
      Make the nsec argument of set_normalized_timespec() s64 to fix the
      problem at hand. This also prevents similar problems for future users
      of set_normalized_timespec().
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NCarsten Emde <carsten.emde@osadl.org>
      LKML-Reference: <new-submission>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      12e09337
  4. 14 1月, 2009 1 次提交
  5. 07 1月, 2009 1 次提交
    • P
      Allow times and time system calls to return small negative values · e3d5a27d
      Paul Mackerras 提交于
      At the moment, the times() system call will appear to fail for a period
      shortly after boot, while the value it want to return is between -4095 and
      -1.  The same thing will also happen for the time() system call on 32-bit
      platforms some time in 2106 or so.
      
      On some platforms, such as x86, this is unavoidable because of the system
      call ABI, but other platforms such as powerpc have a separate error
      indication from the return value, so system calls can in fact return small
      negative values without indicating an error.  On those platforms,
      force_successful_syscall_return() provides a way to indicate that the
      system call return value should not be treated as an error even if it is
      in the range which would normally be taken as a negative error number.
      
      This adds a force_successful_syscall_return() call to the time() and
      times() system calls plus their 32-bit compat versions, so that they don't
      erroneously indicate an error on those platforms whose system call ABI has
      a separate error indication.  This will not affect anything on other
      platforms.
      
      Joakim Tjernlund added the fix for time() and the compat versions of
      time() and times(), after I did the fix for times().
      Signed-off-by: NJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e3d5a27d
  6. 06 9月, 2008 1 次提交
  7. 03 5月, 2008 1 次提交
    • H
      Make constants in kernel/timeconst.h fixed 64 bits · b9095fd8
      H. Peter Anvin 提交于
      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: NH. Peter Anvin <hpa@zytor.com>
      b9095fd8
  8. 01 5月, 2008 2 次提交
  9. 29 4月, 2008 1 次提交
  10. 22 4月, 2008 1 次提交
  11. 09 2月, 2008 2 次提交
    • H
      avoid overflows in kernel/time.c · bdc80787
      H. Peter Anvin 提交于
      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: NH. 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bdc80787
    • L
      time: fix typo in comments · 3eb05676
      Li Zefan 提交于
      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: NLi 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3eb05676
  12. 07 2月, 2008 2 次提交
  13. 02 2月, 2008 1 次提交
  14. 19 10月, 2007 2 次提交
  15. 17 10月, 2007 2 次提交
    • J
      Clean up duplicate includes in kernel/ · a9022e9c
      Jesper Juhl 提交于
      This patch cleans up duplicate includes in
      	kernel/
      Signed-off-by: NJesper Juhl <jesper.juhl@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Reviewed-by: NSatyam Sharma <ssatyam@cse.iitk.ac.in>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a9022e9c
    • I
      time: introduce xtime_seconds · f20bf612
      Ingo Molnar 提交于
      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: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f20bf612
  16. 26 7月, 2007 1 次提交
    • J
      Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time(). · 2c6b47de
      john stultz 提交于
      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: NJohn Stultz <johnstul@us.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2c6b47de
  17. 21 7月, 2007 2 次提交
    • L
      Revert "sys_time() speedup" · 20082208
      Linus Torvalds 提交于
      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: NLinus Torvalds <torvalds@linux-foundation.org>
      20082208
    • B
      [IA64] remove time interpolator · 1f564ad6
      Bob Picco 提交于
      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: NBob Picco <bob.picco@hp.com>
      Signed-off-by: NJohn Stultz <johnstul@us.ibm.com>
      Signed-off-by: NPeter Keilty <peter.keilty@hp.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      1f564ad6
  18. 17 7月, 2007 1 次提交
    • I
      sys_time() speedup · 4e44f349
      Ingo Molnar 提交于
      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: NIngo 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4e44f349
  19. 09 5月, 2007 2 次提交
  20. 26 4月, 2007 2 次提交
    • S
      [TCP] tcp_probe: improvements for net-2.6.22 · 85795d64
      Stephen Hemminger 提交于
      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: NStephen Hemminger <shemminger@linux-foundation.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      85795d64
    • E
      [NET]: convert network timestamps to ktime_t · b7aa0bf7
      Eric Dumazet 提交于
      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: NEric Dumazet <dada1@cosmosbay.com>
      CC: Stephen Hemminger <shemminger@linux-foundation.org>
      CC: John find <linux.kernel@free.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b7aa0bf7
  21. 05 4月, 2007 1 次提交
  22. 17 2月, 2007 2 次提交
  23. 01 10月, 2006 1 次提交
  24. 27 6月, 2006 1 次提交
  25. 01 4月, 2006 1 次提交
    • K
      Fix comments: s/granuality/granularity/ · 8ba8e95e
      Kalin KOZHUHAROV 提交于
      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: NKalin KOZHUHAROV <kalin@thinrope.net>
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      8ba8e95e
  26. 27 3月, 2006 1 次提交
  27. 26 3月, 2006 1 次提交
  28. 04 2月, 2006 1 次提交
  29. 01 2月, 2006 1 次提交
  30. 12 1月, 2006 1 次提交
  31. 11 1月, 2006 1 次提交