<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/kernel/sched.c, branch v2.6.28.9</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>wait: prevent exclusive waiter starvation</title>
<updated>2009-02-12T17:50:23+00:00</updated>
<author>
<name>Johannes Weiner</name>
<email>hannes@cmpxchg.org</email>
</author>
<published>2009-02-04T23:12:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=12585ca5d984a0b27baf6a397cd6d59d9e82ef4c'/>
<id>12585ca5d984a0b27baf6a397cd6d59d9e82ef4c</id>
<content type='text'>
commit 777c6c5f1f6e757ae49ecca2ed72d6b1f523c007 upstream.

With exclusive waiters, every process woken up through the wait queue must
ensure that the next waiter down the line is woken when it has finished.

Interruptible waiters don't do that when aborting due to a signal.  And if
an aborting waiter is concurrently woken up through the waitqueue, noone
will ever wake up the next waiter.

This has been observed with __wait_on_bit_lock() used by
lock_page_killable(): the first contender on the queue was aborting when
the actual lock holder woke it up concurrently.  The aborted contender
didn't acquire the lock and therefor never did an unlock followed by
waking up the next waiter.

Add abort_exclusive_wait() which removes the process' wait descriptor from
the waitqueue, iff still queued, or wakes up the next waiter otherwise.
It does so under the waitqueue lock.  Racing with a wake up means the
aborting process is either already woken (removed from the queue) and will
wake up the next waiter, or it will remove itself from the queue and the
concurrent wake up will apply to the next waiter after it.

Use abort_exclusive_wait() in __wait_event_interruptible_exclusive() and
__wait_on_bit_lock() when they were interrupted by other means than a wake
up through the queue.

[akpm@linux-foundation.org: coding-style fixes]
Reported-by: Chris Mason &lt;chris.mason@oracle.com&gt;
Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Mentored-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Cc: Chuck Lever &lt;cel@citi.umich.edu&gt;
Cc: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 777c6c5f1f6e757ae49ecca2ed72d6b1f523c007 upstream.

With exclusive waiters, every process woken up through the wait queue must
ensure that the next waiter down the line is woken when it has finished.

Interruptible waiters don't do that when aborting due to a signal.  And if
an aborting waiter is concurrently woken up through the waitqueue, noone
will ever wake up the next waiter.

This has been observed with __wait_on_bit_lock() used by
lock_page_killable(): the first contender on the queue was aborting when
the actual lock holder woke it up concurrently.  The aborted contender
didn't acquire the lock and therefor never did an unlock followed by
waking up the next waiter.

Add abort_exclusive_wait() which removes the process' wait descriptor from
the waitqueue, iff still queued, or wakes up the next waiter otherwise.
It does so under the waitqueue lock.  Racing with a wake up means the
aborting process is either already woken (removed from the queue) and will
wake up the next waiter, or it will remove itself from the queue and the
concurrent wake up will apply to the next waiter after it.

Use abort_exclusive_wait() in __wait_event_interruptible_exclusive() and
__wait_on_bit_lock() when they were interrupted by other means than a wake
up through the queue.

[akpm@linux-foundation.org: coding-style fixes]
Reported-by: Chris Mason &lt;chris.mason@oracle.com&gt;
Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Mentored-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Cc: Matthew Wilcox &lt;matthew@wil.cx&gt;
Cc: Chuck Lever &lt;cel@citi.umich.edu&gt;
Cc: Nick Piggin &lt;nickpiggin@yahoo.com.au&gt;
Cc: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>System call wrappers part 08</title>
<updated>2009-01-18T18:43:55+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>heiko.carstens@de.ibm.com</email>
</author>
<published>2009-01-14T13:14:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c395ec360d6607c517267d56cc7ff5c24325edc6'/>
<id>c395ec360d6607c517267d56cc7ff5c24325edc6</id>
<content type='text'>
commit 17da2bd90abf428523de0fb98f7075e00e3ed42e upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 17da2bd90abf428523de0fb98f7075e00e3ed42e upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>System call wrappers part 07</title>
<updated>2009-01-18T18:43:55+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>heiko.carstens@de.ibm.com</email>
</author>
<published>2009-01-14T13:14:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ae250bb546ff02464c1712916230fc60e9b738a9'/>
<id>ae250bb546ff02464c1712916230fc60e9b738a9</id>
<content type='text'>
commit 754fe8d297bfae7b77f7ce866e2fb0c5fb186506 upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 754fe8d297bfae7b77f7ce866e2fb0c5fb186506 upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>System call wrappers part 06</title>
<updated>2009-01-18T18:43:54+00:00</updated>
<author>
<name>Heiko Carstens</name>
<email>heiko.carstens@de.ibm.com</email>
</author>
<published>2009-01-14T13:14:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3330fef2dda401d7634d3412f3756c52f52e0d17'/>
<id>3330fef2dda401d7634d3412f3756c52f52e0d17</id>
<content type='text'>
commit 5add95d4f7cf08f6f62510f19576992912387501 upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5add95d4f7cf08f6f62510f19576992912387501 upstream.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sched: CPU remove deadlock fix</title>
<updated>2008-12-09T18:27:03+00:00</updated>
<author>
<name>Brian King</name>
<email>brking@linux.vnet.ibm.com</email>
</author>
<published>2008-12-09T14:47:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9a2bd244e18ffbb96c8b783210fda4eded7c7e6f'/>
<id>9a2bd244e18ffbb96c8b783210fda4eded7c7e6f</id>
<content type='text'>
Impact: fix possible deadlock in CPU hot-remove path

This patch fixes a possible deadlock scenario in the CPU remove path.
migration_call grabs rq-&gt;lock, then wakes up everything on rq-&gt;migration_queue
with the lock held. Then one of the tasks on the migration queue ends up
calling tg_shares_up which then also tries to acquire the same rq-&gt;lock.

[c000000058eab2e0] c000000000502078 ._spin_lock_irqsave+0x98/0xf0
[c000000058eab370] c00000000008011c .tg_shares_up+0x10c/0x20c
[c000000058eab430] c00000000007867c .walk_tg_tree+0xc4/0xfc
[c000000058eab4d0] c0000000000840c8 .try_to_wake_up+0xb0/0x3c4
[c000000058eab590] c0000000000799a0 .__wake_up_common+0x6c/0xe0
[c000000058eab640] c00000000007ada4 .complete+0x54/0x80
[c000000058eab6e0] c000000000509fa8 .migration_call+0x5fc/0x6f8
[c000000058eab7c0] c000000000504074 .notifier_call_chain+0x68/0xe0
[c000000058eab860] c000000000506568 ._cpu_down+0x2b0/0x3f4
[c000000058eaba60] c000000000506750 .cpu_down+0xa4/0x108
[c000000058eabb10] c000000000507e54 .store_online+0x44/0xa8
[c000000058eabba0] c000000000396260 .sysdev_store+0x3c/0x50
[c000000058eabc10] c0000000001a39b8 .sysfs_write_file+0x124/0x18c
[c000000058eabcd0] c00000000013061c .vfs_write+0xd0/0x1bc
[c000000058eabd70] c0000000001308a4 .sys_write+0x68/0x114
[c000000058eabe30] c0000000000086b4 syscall_exit+0x0/0x40

Signed-off-by: Brian King &lt;brking@linux.vnet.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: fix possible deadlock in CPU hot-remove path

This patch fixes a possible deadlock scenario in the CPU remove path.
migration_call grabs rq-&gt;lock, then wakes up everything on rq-&gt;migration_queue
with the lock held. Then one of the tasks on the migration queue ends up
calling tg_shares_up which then also tries to acquire the same rq-&gt;lock.

[c000000058eab2e0] c000000000502078 ._spin_lock_irqsave+0x98/0xf0
[c000000058eab370] c00000000008011c .tg_shares_up+0x10c/0x20c
[c000000058eab430] c00000000007867c .walk_tg_tree+0xc4/0xfc
[c000000058eab4d0] c0000000000840c8 .try_to_wake_up+0xb0/0x3c4
[c000000058eab590] c0000000000799a0 .__wake_up_common+0x6c/0xe0
[c000000058eab640] c00000000007ada4 .complete+0x54/0x80
[c000000058eab6e0] c000000000509fa8 .migration_call+0x5fc/0x6f8
[c000000058eab7c0] c000000000504074 .notifier_call_chain+0x68/0xe0
[c000000058eab860] c000000000506568 ._cpu_down+0x2b0/0x3f4
[c000000058eaba60] c000000000506750 .cpu_down+0xa4/0x108
[c000000058eabb10] c000000000507e54 .store_online+0x44/0xa8
[c000000058eabba0] c000000000396260 .sysdev_store+0x3c/0x50
[c000000058eabc10] c0000000001a39b8 .sysfs_write_file+0x124/0x18c
[c000000058eabcd0] c00000000013061c .vfs_write+0xd0/0x1bc
[c000000058eabd70] c0000000001308a4 .sys_write+0x68/0x114
[c000000058eabe30] c0000000000086b4 syscall_exit+0x0/0x40

Signed-off-by: Brian King &lt;brking@linux.vnet.ibm.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sched: prevent divide by zero error in cpu_avg_load_per_task, update</title>
<updated>2008-11-29T19:45:15+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-11-29T19:45:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=af6d596fd603219b054c1c90fb16672a9fd441bd'/>
<id>af6d596fd603219b054c1c90fb16672a9fd441bd</id>
<content type='text'>
Regarding the bug addressed in:

  4cd4262: sched: prevent divide by zero error in cpu_avg_load_per_task

Linus points out that the fix is not complete:

&gt; There's nothing that keeps gcc from deciding not to reload
&gt; rq-&gt;nr_running.
&gt;
&gt; Of course, in _practice_, I don't think gcc ever will (if it decides
&gt; that it will spill, gcc is likely going to decide that it will
&gt; literally spill the local variable to the stack rather than decide to
&gt; reload off the pointer), but it's a valid compiler optimization, and
&gt; it even has a name (rematerialization).
&gt;
&gt; So I suspect that your patch does fix the bug, but it still leaves the
&gt; fairly unlikely _potential_ for it to re-appear at some point.
&gt;
&gt; We have ACCESS_ONCE() as a macro to guarantee that the compiler
&gt; doesn't rematerialize a pointer access. That also would clarify
&gt; the fact that we access something unsafe outside a lock.

So make sure our nr_running value is immutable and cannot change
after we check it for nonzero.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Regarding the bug addressed in:

  4cd4262: sched: prevent divide by zero error in cpu_avg_load_per_task

Linus points out that the fix is not complete:

&gt; There's nothing that keeps gcc from deciding not to reload
&gt; rq-&gt;nr_running.
&gt;
&gt; Of course, in _practice_, I don't think gcc ever will (if it decides
&gt; that it will spill, gcc is likely going to decide that it will
&gt; literally spill the local variable to the stack rather than decide to
&gt; reload off the pointer), but it's a valid compiler optimization, and
&gt; it even has a name (rematerialization).
&gt;
&gt; So I suspect that your patch does fix the bug, but it still leaves the
&gt; fairly unlikely _potential_ for it to re-appear at some point.
&gt;
&gt; We have ACCESS_ONCE() as a macro to guarantee that the compiler
&gt; doesn't rematerialize a pointer access. That also would clarify
&gt; the fact that we access something unsafe outside a lock.

So make sure our nr_running value is immutable and cannot change
after we check it for nonzero.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sched: prevent divide by zero error in cpu_avg_load_per_task</title>
<updated>2008-11-27T09:29:52+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2008-11-27T02:04:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4cd4262034849da01eb88659af677b69f8169f06'/>
<id>4cd4262034849da01eb88659af677b69f8169f06</id>
<content type='text'>
Impact: fix divide by zero crash in scheduler rebalance irq

While testing the branch profiler, I hit this crash:

divide error: 0000 [#1] PREEMPT SMP
[...]
RIP: 0010:[&lt;ffffffff8024a008&gt;]  [&lt;ffffffff8024a008&gt;] cpu_avg_load_per_task+0x50/0x7f
[...]
Call Trace:
 &lt;IRQ&gt; &lt;0&gt; [&lt;ffffffff8024fd43&gt;] find_busiest_group+0x3e5/0xcaa
 [&lt;ffffffff8025da75&gt;] rebalance_domains+0x2da/0xa21
 [&lt;ffffffff80478769&gt;] ? find_next_bit+0x1b2/0x1e6
 [&lt;ffffffff8025e2ce&gt;] run_rebalance_domains+0x112/0x19f
 [&lt;ffffffff8026d7c2&gt;] __do_softirq+0xa8/0x232
 [&lt;ffffffff8020ea7c&gt;] call_softirq+0x1c/0x3e
 [&lt;ffffffff8021047a&gt;] do_softirq+0x94/0x1cd
 [&lt;ffffffff8026d5eb&gt;] irq_exit+0x6b/0x10e
 [&lt;ffffffff8022e6ec&gt;] smp_apic_timer_interrupt+0xd3/0xff
 [&lt;ffffffff8020e4b3&gt;] apic_timer_interrupt+0x13/0x20

The code for cpu_avg_load_per_task has:

	if (rq-&gt;nr_running)
		rq-&gt;avg_load_per_task = rq-&gt;load.weight / rq-&gt;nr_running;

The runqueue lock is not held here, and there is nothing that prevents
the rq-&gt;nr_running from going to zero after it passes the if condition.

The branch profiler simply made the race window bigger.

This patch saves off the rq-&gt;nr_running to a local variable and uses that
for both the condition and the division.

Signed-off-by: Steven Rostedt &lt;srostedt@redhat.com&gt;
Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: fix divide by zero crash in scheduler rebalance irq

While testing the branch profiler, I hit this crash:

divide error: 0000 [#1] PREEMPT SMP
[...]
RIP: 0010:[&lt;ffffffff8024a008&gt;]  [&lt;ffffffff8024a008&gt;] cpu_avg_load_per_task+0x50/0x7f
[...]
Call Trace:
 &lt;IRQ&gt; &lt;0&gt; [&lt;ffffffff8024fd43&gt;] find_busiest_group+0x3e5/0xcaa
 [&lt;ffffffff8025da75&gt;] rebalance_domains+0x2da/0xa21
 [&lt;ffffffff80478769&gt;] ? find_next_bit+0x1b2/0x1e6
 [&lt;ffffffff8025e2ce&gt;] run_rebalance_domains+0x112/0x19f
 [&lt;ffffffff8026d7c2&gt;] __do_softirq+0xa8/0x232
 [&lt;ffffffff8020ea7c&gt;] call_softirq+0x1c/0x3e
 [&lt;ffffffff8021047a&gt;] do_softirq+0x94/0x1cd
 [&lt;ffffffff8026d5eb&gt;] irq_exit+0x6b/0x10e
 [&lt;ffffffff8022e6ec&gt;] smp_apic_timer_interrupt+0xd3/0xff
 [&lt;ffffffff8020e4b3&gt;] apic_timer_interrupt+0x13/0x20

The code for cpu_avg_load_per_task has:

	if (rq-&gt;nr_running)
		rq-&gt;avg_load_per_task = rq-&gt;load.weight / rq-&gt;nr_running;

The runqueue lock is not held here, and there is nothing that prevents
the rq-&gt;nr_running from going to zero after it passes the if condition.

The branch profiler simply made the race window bigger.

This patch saves off the rq-&gt;nr_running to a local variable and uses that
for both the condition and the division.

Signed-off-by: Steven Rostedt &lt;srostedt@redhat.com&gt;
Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cpuset: fix regression when failed to generate sched domains</title>
<updated>2008-11-18T07:44:51+00:00</updated>
<author>
<name>Li Zefan</name>
<email>lizf@cn.fujitsu.com</email>
</author>
<published>2008-11-18T06:02:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=700018e0a77b4113172257fcdaa1c58e27a5074f'/>
<id>700018e0a77b4113172257fcdaa1c58e27a5074f</id>
<content type='text'>
Impact: properly rebuild sched-domains on kmalloc() failure

When cpuset failed to generate sched domains due to kmalloc()
failure, the scheduler should fallback to the single partition
'fallback_doms' and rebuild sched domains, but now it only
destroys but not rebuilds sched domains.

The regression was introduced by:

| commit dfb512ec4834116124da61d6c1ee10fd0aa32bd6
| Author: Max Krasnyansky &lt;maxk@qualcomm.com&gt;
| Date:   Fri Aug 29 13:11:41 2008 -0700
|
|    sched: arch_reinit_sched_domains() must destroy domains to force rebuild

After the above commit, partition_sched_domains(0, NULL, NULL) will
only destroy sched domains and partition_sched_domains(1, NULL, NULL)
will create the default sched domain.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Max Krasnyansky &lt;maxk@qualcomm.com&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: properly rebuild sched-domains on kmalloc() failure

When cpuset failed to generate sched domains due to kmalloc()
failure, the scheduler should fallback to the single partition
'fallback_doms' and rebuild sched domains, but now it only
destroys but not rebuilds sched domains.

The regression was introduced by:

| commit dfb512ec4834116124da61d6c1ee10fd0aa32bd6
| Author: Max Krasnyansky &lt;maxk@qualcomm.com&gt;
| Date:   Fri Aug 29 13:11:41 2008 -0700
|
|    sched: arch_reinit_sched_domains() must destroy domains to force rebuild

After the above commit, partition_sched_domains(0, NULL, NULL) will
only destroy sched domains and partition_sched_domains(1, NULL, NULL)
will create the default sched domain.

Signed-off-by: Li Zefan &lt;lizf@cn.fujitsu.com&gt;
Cc: Max Krasnyansky &lt;maxk@qualcomm.com&gt;
Cc: &lt;stable@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sched: fix init_idle()'s use of sched_clock()</title>
<updated>2008-11-12T19:05:50+00:00</updated>
<author>
<name>Ingo Molnar</name>
<email>mingo@elte.hu</email>
</author>
<published>2008-11-12T19:05:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5cbd54ef470d880fc37fbe4b21eb514806d51e0d'/>
<id>5cbd54ef470d880fc37fbe4b21eb514806d51e0d</id>
<content type='text'>
Maciej Rutecki reported:

&gt; I have this bug during suspend to disk:
&gt;
&gt; [  188.592151] Enabling non-boot CPUs ...
&gt; [  188.592151] SMP alternatives: switching to SMP code
&gt; [  188.666058] BUG: using smp_processor_id() in preemptible
&gt; [00000000]
&gt; code: suspend_to_disk/2934
&gt; [  188.666064] caller is native_sched_clock+0x2b/0x80

Which, as noted by Linus, was caused by me, via:

  7cbaef9c "sched: optimize sched_clock() a bit"

Move the rq locking a bit earlier in the initialization sequence,
that will make the sched_clock() call in init_idle() non-preemptible.

Reported-by: Maciej Rutecki &lt;maciej.rutecki@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Maciej Rutecki reported:

&gt; I have this bug during suspend to disk:
&gt;
&gt; [  188.592151] Enabling non-boot CPUs ...
&gt; [  188.592151] SMP alternatives: switching to SMP code
&gt; [  188.666058] BUG: using smp_processor_id() in preemptible
&gt; [00000000]
&gt; code: suspend_to_disk/2934
&gt; [  188.666064] caller is native_sched_clock+0x2b/0x80

Which, as noted by Linus, was caused by me, via:

  7cbaef9c "sched: optimize sched_clock() a bit"

Move the rq locking a bit earlier in the initialization sequence,
that will make the sched_clock() call in init_idle() non-preemptible.

Reported-by: Maciej Rutecki &lt;maciej.rutecki@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>sched: fix stale value in average load per task</title>
<updated>2008-11-12T11:33:50+00:00</updated>
<author>
<name>Balbir Singh</name>
<email>balbir@linux.vnet.ibm.com</email>
</author>
<published>2008-11-12T10:49:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a2d477778e82a60a0b7114cefdb70aa43af28782'/>
<id>a2d477778e82a60a0b7114cefdb70aa43af28782</id>
<content type='text'>
Impact: fix load balancer load average calculation accuracy

cpu_avg_load_per_task() returns a stale value when nr_running is 0.
It returns an older stale (caculated when nr_running was non zero) value.

This patch returns and sets rq-&gt;avg_load_per_task to zero when nr_running
is 0.

Compile and boot tested on a x86_64 box.

Signed-off-by: Balbir Singh &lt;balbir@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;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: fix load balancer load average calculation accuracy

cpu_avg_load_per_task() returns a stale value when nr_running is 0.
It returns an older stale (caculated when nr_running was non zero) value.

This patch returns and sets rq-&gt;avg_load_per_task to zero when nr_running
is 0.

Compile and boot tested on a x86_64 box.

Signed-off-by: Balbir Singh &lt;balbir@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;
</pre>
</div>
</content>
</entry>
</feed>
