]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ia32 sched_clock() deadlock fix
authorAndrew Morton <akpm@osdl.org>
Tue, 6 Jan 2004 23:52:48 +0000 (15:52 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 6 Jan 2004 23:52:48 +0000 (15:52 -0800)
From: Ingo Molnar <mingo@elte.hu>,

Voyager is getting odd deadlocks due to the taking of xtime_lock() in
sched_clock()->get_jiffies_64().

I had this patch queued up to fix a different deadlock, which occurs when we
relax the requirement that TSC's be synchronised across CPUs.  But it will
fix James' deadlock too.

arch/i386/kernel/timers/timer_tsc.c

index 0030d7989fea308a4549a296f4ea665553c4b7c8..cafc53150595d9d6021836909ea85b55bceeaee8 100644 (file)
@@ -140,7 +140,8 @@ unsigned long long sched_clock(void)
 #ifndef CONFIG_NUMA
        if (!use_tsc)
 #endif
-               return (unsigned long long)get_jiffies_64() * (1000000000 / HZ);
+               /* no locking but a rare wrong value is not a big deal */
+               return jiffies_64 * (1000000000 / HZ);
 
        /* Read the Time Stamp Counter */
        rdtscll(this_offset);