<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/sched_clock.c, branch v2.6.27.8</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v2.6.27.8</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v2.6.27.8'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2008-11-07T03:05:50Z</updated>
<entry>
<title>sched_clock: prevent scd-&gt;clock from moving backwards</title>
<updated>2008-11-07T03:05:50Z</updated>
<author>
<name>Dave Kleikamp</name>
<email>shaggy@linux.vnet.ibm.com</email>
</author>
<published>2008-10-26T22:20:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5e55aa8db085dad1aabb4574c73c23c7ae571e7b'/>
<id>urn:sha1:5e55aa8db085dad1aabb4574c73c23c7ae571e7b</id>
<content type='text'>
commit 5b7dba4ff834259a5623e03a565748704a8fe449 upstream

sched_clock: prevent scd-&gt;clock from moving backwards

When sched_clock_cpu() couples the clocks between two cpus, it may
increment scd-&gt;clock beyond the GTOD tick window that __update_sched_clock()
uses to clamp the clock.  A later call to __update_sched_clock() may move
the clock back to scd-&gt;tick_gtod + TICK_NSEC, violating the clock's
monotonic property.

This patch ensures that scd-&gt;clock will not be set backward.

Signed-off-by: Dave Kleikamp &lt;shaggy@linux.vnet.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Cc: Chuck Ebbert &lt;cebbert@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>sched_clock: fix cpu_clock()</title>
<updated>2008-08-25T15:39:57Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2008-08-25T15:15:34Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=354879bb977e06695993435745f06a0f6d39ce2b'/>
<id>urn:sha1:354879bb977e06695993435745f06a0f6d39ce2b</id>
<content type='text'>
This patch fixes 3 issues:

a) it removes the dependency on jiffies, because jiffies are incremented
   by a single CPU, and the tick is not synchronized between CPUs. Therefore
   relying on it to calculate a window to clip whacky TSC values doesn't work
   as it can drift around.

   So instead use [GTOD, GTOD+TICK_NSEC) as the window.

b) __update_sched_clock() did (roughly speaking):

   delta = sched_clock() - scd-&gt;tick_raw;
   clock += delta;

   Which gives exponential growth, instead of linear.

c) allows the sched_clock_cpu() value to warp the u64 without breaking.

the results are more reliable sched_clock() deltas:

           before       after   sched_clock

cpu_clock: 15750        51312   51488
cpu_clock: 59719        51052   50947
cpu_clock: 15879        51249   51061
cpu_clock: 1            50933   51198
cpu_clock: 1            50931   51039
cpu_clock: 1            51093   50981
cpu_clock: 1            51043   51040
cpu_clock: 1            50959   50938
cpu_clock: 1            50981   51011
cpu_clock: 1            51364   51212
cpu_clock: 1            51219   51273
cpu_clock: 1            51389   51048
cpu_clock: 1            51285   51611
cpu_clock: 1            50964   51137
cpu_clock: 1            50973   50968
cpu_clock: 1            50967   50972
cpu_clock: 1            58910   58485
cpu_clock: 1            51082   51025
cpu_clock: 1            50957   50958
cpu_clock: 1            50958   50957
cpu_clock: 1006128      51128   50971
cpu_clock: 1            51107   51155
cpu_clock: 1            51371   51081
cpu_clock: 1            51104   51365
cpu_clock: 1            51363   51309
cpu_clock: 1            51107   51160
cpu_clock: 1            51139   51100
cpu_clock: 1            51216   51136
cpu_clock: 1            51207   51215
cpu_clock: 1            51087   51263
cpu_clock: 1            51249   51177
cpu_clock: 1            51519   51412
cpu_clock: 1            51416   51255
cpu_clock: 1            51591   51594
cpu_clock: 1            50966   51374
cpu_clock: 1            50966   50966
cpu_clock: 1            51291   50948
cpu_clock: 1            50973   50867
cpu_clock: 1            50970   50970
cpu_clock: 998306       50970   50971
cpu_clock: 1            50971   50970
cpu_clock: 1            50970   50970
cpu_clock: 1            50971   50971
cpu_clock: 1            50970   50970
cpu_clock: 1            51351   50970
cpu_clock: 1            50970   51352
cpu_clock: 1            50971   50970
cpu_clock: 1            50970   50970
cpu_clock: 1            51321   50971
cpu_clock: 1            50974   51324

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched_clock: delay using sched_clock()</title>
<updated>2008-08-11T06:59:03Z</updated>
<author>
<name>Peter Zijlstra</name>
<email>a.p.zijlstra@chello.nl</email>
</author>
<published>2008-08-11T06:59:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c1955a3d4762e7a9bf84035eb3c4886a900f0d15'/>
<id>urn:sha1:c1955a3d4762e7a9bf84035eb3c4886a900f0d15</id>
<content type='text'>
Some arch's can't handle sched_clock() being called too early - delay
this until sched_clock_init() has been called.

Reported-by: Bill Gatliff &lt;bgat@billgatliff.com&gt;
Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Tested-by: Nishanth Aravamudan &lt;nacc@us.ibm.com&gt;
CC: Russell King - ARM Linux &lt;linux@arm.linux.org.uk&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>sched clock: couple local and remote clocks</title>
<updated>2008-07-31T15:21:01Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-07-30T08:22:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4a273f209cc95d148f79b4c96d3d03997b44ffda'/>
<id>urn:sha1:4a273f209cc95d148f79b4c96d3d03997b44ffda</id>
<content type='text'>
When taking the time of a remote CPU, use the opportunity to
couple (sync) the clocks to each other. (in a monotonic way)

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Mike Galbraith &lt;efault@gmx.de&gt;
</content>
</entry>
<entry>
<title>sched clock: simplify __update_sched_clock()</title>
<updated>2008-07-31T15:20:55Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-07-30T08:15:55Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=56b906126d33904d4d67615d0d5b95dbdf1f27ca'/>
<id>urn:sha1:56b906126d33904d4d67615d0d5b95dbdf1f27ca</id>
<content type='text'>
- return the current clock instead of letting callers
  fetch it from scd-&gt;clock

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Mike Galbraith &lt;efault@gmx.de&gt;
</content>
</entry>
<entry>
<title>sched: eliminate scd-&gt;prev_raw</title>
<updated>2008-07-31T15:20:49Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-07-30T08:13:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=18e4e36c66d6edbdefc639692206cdf01e468713'/>
<id>urn:sha1:18e4e36c66d6edbdefc639692206cdf01e468713</id>
<content type='text'>
eliminate prev_raw and use tick_raw instead.

It's enough to base the current time on the scheduler tick timestamp
alone - the monotonicity and maximum checks will prevent any damage.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Mike Galbraith &lt;efault@gmx.de&gt;
</content>
</entry>
<entry>
<title>sched clock: clean up sched_clock_cpu()</title>
<updated>2008-07-31T15:20:42Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-07-30T07:39:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=50526968e99afbca34924abcb04658b6dd5c5ea5'/>
<id>urn:sha1:50526968e99afbca34924abcb04658b6dd5c5ea5</id>
<content type='text'>
- simplify the remote clock rebasing

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Mike Galbraith &lt;efault@gmx.de&gt;
</content>
</entry>
<entry>
<title>sched clock: revert various sched_clock() changes</title>
<updated>2008-07-31T15:20:29Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-04-14T06:50:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e4e4e534faa3c2be4e165ce414f44b76ada7208c'/>
<id>urn:sha1:e4e4e534faa3c2be4e165ce414f44b76ada7208c</id>
<content type='text'>
Found an interactivity problem on a quad core test-system - simple
CPU loops would occasionally delay the system un an unacceptable way.

After much debugging with Peter Zijlstra it turned out that the problem
is caused by the string of sched_clock() changes - they caused the CPU
clock to jump backwards a bit - which confuses the scheduler arithmetics.

(which is unsigned for performance reasons)

So revert:

 # c300ba2: sched_clock: and multiplier for TSC to gtod drift
 # c0c8773: sched_clock: only update deltas with local reads.
 # af52a90: sched_clock: stop maximum check on NO HZ
 # f7cce27: sched_clock: widen the max and min time

This solves the interactivity problems.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Acked-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Acked-by: Mike Galbraith &lt;efault@gmx.de&gt;
</content>
</entry>
<entry>
<title>sched: move sched_clock before first use</title>
<updated>2008-07-28T14:35:03Z</updated>
<author>
<name>Hugh Dickins</name>
<email>hugh@veritas.com</email>
</author>
<published>2008-07-25T18:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2c3d103ba90827cfb478bf10464d9b5b9cea369c'/>
<id>urn:sha1:2c3d103ba90827cfb478bf10464d9b5b9cea369c</id>
<content type='text'>
Move sched_clock() up to stop warning: weak declaration of `sched_clock'
after first use results in unspecified behavior (if -fno-unit-at-a-time).

Signed-off-by: Hugh Dickins &lt;hugh@veritas.com&gt;
Cc: Mike Travis &lt;travis@sgi.com&gt;
Cc: Ben Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Linuxppc-dev@ozlabs.org
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sched/clock' into sched/devel</title>
<updated>2008-07-14T10:19:13Z</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-07-14T10:19:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=361833efac4d277d209008e1e0658e597bc1bdef'/>
<id>urn:sha1:361833efac4d277d209008e1e0658e597bc1bdef</id>
<content type='text'>
</content>
</entry>
</feed>
