]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
sched: Prevent compiler from optimising the sched_avg_update() loop
authorWill Deacon <will.deacon@arm.com>
Mon, 24 May 2010 19:11:43 +0000 (12:11 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 2 Aug 2010 17:20:52 +0000 (10:20 -0700)
commit2d216ac392eea6c6b85d038dc7788bfe44b77040
tree0cd866936ed579c24cbdafd46f509c4895b1dde1
parent8c8fba3f0bbdf2269d4a4b7bd50ad53f0a1db75e
sched: Prevent compiler from optimising the sched_avg_update() loop

commit 0d98bb2656e9bd2dfda2d089db1fe1dbdab41504 upstream.

GCC 4.4.1 on ARM has been observed to replace the while loop in
sched_avg_update with a call to uldivmod, resulting in the
following build failure at link-time:

kernel/built-in.o: In function `sched_avg_update':
 kernel/sched.c:1261: undefined reference to `__aeabi_uldivmod'
 kernel/sched.c:1261: undefined reference to `__aeabi_uldivmod'
make: *** [.tmp_vmlinux1] Error 1

This patch introduces a fake data hazard to the loop body to
prevent the compiler optimising the loop away.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/sched.c