<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/asm-generic/cputime.h, branch v3.0</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.0</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.0'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2011-01-26T11:33:20Z</updated>
<entry>
<title>time: Add nsecs_to_cputime64 interface for asm-generic</title>
<updated>2011-01-26T11:33:20Z</updated>
<author>
<name>Venkatesh Pallipadi</name>
<email>venki@google.com</email>
</author>
<published>2010-12-22T01:09:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a1dabb6bfffccb897eff3e1d102dacf2a4bedf3b'/>
<id>urn:sha1:a1dabb6bfffccb897eff3e1d102dacf2a4bedf3b</id>
<content type='text'>
Add nsecs_to_cputime64 interface. This is used in following patches that
updates cpu irq stat based on ns granularity info in IRQ_TIME_ACCOUNTING.

Tested-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Venkatesh Pallipadi &lt;venki@google.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
LKML-Reference: &lt;1292980144-28796-3-git-send-email-venki@google.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>taskstats: use real microsecond granularity for CPU times</title>
<updated>2010-10-28T01:03:17Z</updated>
<author>
<name>Michael Holzheu</name>
<email>holzheu@linux.vnet.ibm.com</email>
</author>
<published>2010-10-27T22:34:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d57af9b2142f31a39dcfdeb30776baadfc802827'/>
<id>urn:sha1:d57af9b2142f31a39dcfdeb30776baadfc802827</id>
<content type='text'>
The taskstats interface uses microsecond granularity for the user and
system time values.  The conversion from cputime to the taskstats values
uses the cputime_to_msecs primitive which effectively limits the
granularity to milliseconds.  Add the cputime_to_usecs primitive for
architectures that have better, more precise CPU time values.  Remove
cputime_to_msecs primitive because there are no more users left.

Signed-off-by: Michael Holzheu &lt;holzheu@linux.vnet.ibm.com&gt;
Acked-by: Balbir Singh &lt;balbir@linux.vnet.ibm.com&gt;
Cc: Luck Tony &lt;tony.luck@intel.com&gt;
Cc: Shailabh Nagar &lt;nagar1234@in.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Shailabh Nagar &lt;nagar@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>cputime: Optimize jiffies_to_cputime(1)</title>
<updated>2009-08-03T12:48:36Z</updated>
<author>
<name>Stanislaw Gruszka</name>
<email>sgruszka@redhat.com</email>
</author>
<published>2009-07-29T10:15:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a42548a18866e87092db93b771e6c5b060d78401'/>
<id>urn:sha1:a42548a18866e87092db93b771e6c5b060d78401</id>
<content type='text'>
For powerpc with CONFIG_VIRT_CPU_ACCOUNTING
jiffies_to_cputime(1) is not compile time constant and run time
calculations are quite expensive. To optimize we use
precomputed value. For all other architectures is is
preprocessor definition.

Signed-off-by: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
LKML-Reference: &lt;1248862529-6063-5-git-send-email-sgruszka@redhat.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>taskstats scaled time cleanup</title>
<updated>2008-02-06T18:41:00Z</updated>
<author>
<name>Michael Neuling</name>
<email>mikey@neuling.org</email>
</author>
<published>2008-02-06T09:36:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=06b8e878a9bc9301201cffe186eba99c4185f20a'/>
<id>urn:sha1:06b8e878a9bc9301201cffe186eba99c4185f20a</id>
<content type='text'>
This moves the ability to scale cputime into generic code.  This allows us
to fix the issue in kernel/timer.c (noticed by Balbir) where we could only
add an unscaled value to the scaled utime/stime.

This adds a cputime_to_scaled function.  As before, the POWERPC version
does the scaling based on the last SPURR/PURR ratio calculated.  The
generic and s390 (only other arch to implement asm/cputime.h) versions are
both NOPs.

Also moves the SPURR and PURR snapshots closer.

Signed-off-by: Michael Neuling &lt;mikey@neuling.org&gt;
Cc: Jay Lan &lt;jlan@engr.sgi.com&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>[CPUFREQ] Remove slowdown from ondemand sampling path.</title>
<updated>2006-06-30T05:29:47Z</updated>
<author>
<name>Venkatesh Pallipadi</name>
<email>venkatesh.pallipadi@intel.com</email>
</author>
<published>2006-06-28T20:49:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ccb2fe209dac9ff67f6351e783e610073afaaeaf'/>
<id>urn:sha1:ccb2fe209dac9ff67f6351e783e610073afaaeaf</id>
<content type='text'>
Remove slowdown from ondemand sampling path. This reduces the code path length
in dbs_check_cpu() by half. slowdown was not used by ondemand by default.
If there are any user level tools that were using this tunable, they
may report error now.

Signed-off-by: Alexey Starikovskiy &lt;alexey.y.starikovskiy@intel.com&gt;
Signed-off-by: Venkatesh Pallipadi &lt;venkatesh.pallipadi@intel.com&gt;
Signed-off-by: Dave Jones &lt;davej@redhat.com&gt;
</content>
</entry>
<entry>
<title>[PATCH] posix-cpu-timers and cputime_t divisons.</title>
<updated>2005-03-28T12:00:22Z</updated>
<author>
<name>Martin Schwidefsky</name>
<email>schwidefsky@de.ibm.com</email>
</author>
<published>2005-03-28T12:00:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7b8f061e04e3090a40f2828434f17c9003013cc7'/>
<id>urn:sha1:7b8f061e04e3090a40f2828434f17c9003013cc7</id>
<content type='text'>
The posix cpu timers introduced code that will not work with an arbitrary
type for cputime_t.  In particular the division of two cputime_t values
broke the s390 build because cputime_t is define as an unsigned long long.

The first problem is the division of a cputime_t value by a number of
threads.  That is a cputime_t divided by an integer.  The patch adds
another macro cputime_div to the cputime macro regime which implements this
type of division and replaces all occurences of a cputime / nthread in the
posix cpu timer code.

Next problem is bump_cpu_timer. This function is severly broken:

1) In the body of the first if statement a timer-&gt;it.cpu.incr.sched is
   used as the second argument of do_div.  do_div expects an unsigned long
   as "base" parameter but timer-&gt;it.cpu.incr.sched is an unsigned long
   long.  If the timer increment ever happens to be &gt;= 2^32 the result is
   wrong and if the lower 32 bits are zero this even crashes with a fixed
   point divide exception.

2) The cputime_le(now.cpu, timer-&gt;it.cpu.expires.cpu) in the else if
   condition is wrong.  The cputime_le() reads as "now.cpu &lt;=
   timer-&gt;it.cpu.expires.cpu" and the subsequent cputime_ge() reads as
   "now.cpu &gt;= timer.it.cpu.expires.cpu".  That means that the two values
   needs to be equal to make the body of the second if to have any effect. 
   The first cputime_le should be a cputime_ge.

3) timer-&gt;it.cpu.expires.cpu and delta in the else part of the if are of
   type cputime_t.  A division of two cputime_t values is undefined (think
   of cputime_t as e.g.  a struct timespec, that just doesn't work).  We
   could add a primitive for this type of division but we'd end up with a
   64 bit division or something even more complicated.

The solution for bump_cpu_timer is to use the "slow" division algorithm
that does shifts and subtracts.  That adds yet another cputime macro,
cputime_halve to do the right shift of a cputime value.

The next problem is in arm_timer.  The UPDATE_CLOCK macro does the wrong
thing for it_prof_expires and it_virt_expires.  Expanded the macro and
added the cputime magic to it_prof/it_virt.

The remaining problems are rather simple, timespec_to_jiffies instead of
timespec_to_cputime and several cases where cputime_eq with cputime_zero
needs to be used instead of "== 0".

What still worries me a bit is to use "timer-&gt;it.cpu.incr.sched == 0" as
check if the timer is armed at all.  It should work but its not really
clean.

Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] cputime: simplifiy generic cputime_to_secs/secs_to_cputime</title>
<updated>2005-02-02T00:48:52Z</updated>
<author>
<name>Martin Schwidefsky</name>
<email>schwidefsky@de.ibm.com</email>
</author>
<published>2005-02-02T00:48:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7fe83ffc3cb040fd0ef50cc7e3e33dbc46595b75'/>
<id>urn:sha1:7fe83ffc3cb040fd0ef50cc7e3e33dbc46595b75</id>
<content type='text'>
The cputime_to_secs and secs_to_cputime primitives in
include/asm-generic/cputime.h can be simplified since the default cputime
implementation assumes that cputime is measured in jiffies.  The
intermediate conversion to milliseconds is superflous.

Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] cputime.h seems to assume HZ==1000</title>
<updated>2005-01-21T05:48:16Z</updated>
<author>
<name>Roland McGrath</name>
<email>roland@redhat.com</email>
</author>
<published>2005-01-21T05:48:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b57bbdb10b4823de638fa1d5439c15b1b54b1f12'/>
<id>urn:sha1:b57bbdb10b4823de638fa1d5439c15b1b54b1f12</id>
<content type='text'>
There's 1000 msecs in a second. No relation to HZ, which just
happens to be 1000 in some cases.

Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
<entry>
<title>[PATCH] cputime: introduce cputime</title>
<updated>2005-01-11T09:40:38Z</updated>
<author>
<name>Martin Schwidefsky</name>
<email>schwidefsky@de.ibm.com</email>
</author>
<published>2005-01-11T09:40:38Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0a71336b6a8858a525007c5b4e0d14ba57f9f315'/>
<id>urn:sha1:0a71336b6a8858a525007c5b4e0d14ba57f9f315</id>
<content type='text'>
This patch introduces the concept of (virtual) cputime.  Each architecture
can define its method to measure cputime.  The main idea is to define a
cputime_t type and a set of operations on it (see asm-generic/cputime.h).
Then use the type for utime, stime, cutime, cstime, it_virt_value,
it_virt_incr, it_prof_value and it_prof_incr and use the cputime operations
for each access to these variables.  The default implementation is jiffies
based and the effect of this patch for architectures which use the default
implementation should be neglectible.

There is a second type cputime64_t which is necessary for the kernel_stat
cpu statistics.  The default cputime_t is 32 bit and based on HZ, this will
overflow after 49.7 days.  This is not enough for kernel_stat (ihmo not
enough for a processes too), so it is necessary to have a 64 bit type.

The third thing that gets introduced by this patch is an additional field
for the /proc/stat interface: cpu steal time.  An architecture can account
cpu steal time by calls to the account_stealtime function.  The cpu which
backs a virtual processor doesn't spent all of its time for the virtual
cpu.  To get meaningful cpu usage numbers this involuntary wait time needs
to be accounted and exported to user space.

From: Hugh Dickins &lt;hugh@veritas.com&gt;

The p-&gt;signal check in account_system_time is insufficient.  If the timer
interrupt hits near the end of exit_notify, after EXIT_ZOMBIE has been set,
another cpu may release_task (NULLifying p-&gt;signal) in between
account_system_time's check and check_rlimit's dereference.  Nor should
account_it_prof risk send_sig.  But surely account_user_time is safe?

Signed-off-by: Hugh Dickins &lt;hugh@veritas.com&gt;
Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@osdl.org&gt;
</content>
</entry>
</feed>
