lkml.org 
[lkml]   [2007]   [Jul]   [29]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 28 Jul 2007 23:03:08 -0700
FromJeremy Fitzhardinge <>
SubjectRe: [patch] sched: make cpu_clock() not use the rq clock
Ingo Molnar wrote:
> Subject: sched: make cpu_clock() not use the rq clock
> 

This subject doesn't make much sense to me.  All this patch does is get
the rq's current time under irq_disable rather than spinlock, right?

    J

> From: Ingo Molnar <mingo@elte.hu>
>
> 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>
> ---
>  kernel/sched.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> Index: linux-rt-rebase.q/kernel/sched.c
> ===================================================================
> --- linux-rt-rebase.q.orig/kernel/sched.c
> +++ linux-rt-rebase.q/kernel/sched.c
> @@ -446,13 +446,12 @@ static inline unsigned long long rq_cloc
>   */
>  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;
>  }
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-29 06:07    [from the cache]
©2003-2008