Skip to content

Commit

Permalink
[PATCH] sched: make cpu_clock() not use the rq clock
Browse files Browse the repository at this point in the history
it is enough to disable interrupts to get the precise rq-clock
of the local CPU.

this also solves an NMI watchdog regression: the NMI watchdog
calls touch_softlockup_watchdog(), which might deadlock on
rq->lock if the NMI hits an rq-locked critical section.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jul 26, 2007
1 parent 018a221 commit 2cd4d0e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,12 @@ static inline unsigned long long rq_clock(struct rq *rq)
*/
unsigned long long cpu_clock(int cpu)
{
struct rq *rq = cpu_rq(cpu);
unsigned long long now;
unsigned long flags;

spin_lock_irqsave(&rq->lock, flags);
now = rq_clock(rq);
spin_unlock_irqrestore(&rq->lock, flags);
local_irq_save(flags);
now = rq_clock(cpu_rq(cpu));
local_irq_restore(flags);

return now;
}
Expand Down

0 comments on commit 2cd4d0e

Please sign in to comment.