[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070621210630.GA7521@elte.hu>
Date: Thu, 21 Jun 2007 23:06:30 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Eric Dumazet <dada1@...mosbay.com>,
Chuck Ebbert <cebbert@...hat.com>,
Jarek Poplawski <jarkao2@...pl>,
Miklos Szeredi <miklos@...redi.hu>, chris@...ee.ca,
linux-kernel@...r.kernel.org, tglx@...utronix.de,
akpm@...ux-foundation.org
Subject: Re: [BUG] long freezes on thinkpad t60
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Thu, 21 Jun 2007, Ingo Molnar wrote:
> >
> > damn, i first wrote up an explanation about why that ugly __delay(1) is
> > there (it almost hurts my eyes when i look at it!) but then deleted it
> > as superfluous :-/
>
> I'm fine with a delay, but the __delay(1) is simply not "correct". It
> doesn't do anything.
it's a bit trickier than that. Yes, it's a simple 1-entry loop and thus
makes little sense to call. But it's a loop that got boot-time
calibrated, so we can do this in the spinlock-debug code:
u64 loops = loops_per_jiffy * HZ;
this guarantees that we will loop for _at least_ 1 second before
printing a message. (in practice it's much longer, especially with the
current naive trylock approach)
Why? Because as part of the activities that the spin-loop does, we also
do everything that an mdelay(1000) would do. We do it 'piecemail-wise',
and we do it very inefficiently, but the lower time-bound should be
guaranteed. This is done because most of the problems were caused by too
short looping and bogus debug printouts. So this is basically an
open-coded udelay implementation.
Furthermore, with the spin_is_locked() fix i just sent, the __loop(1)
solution should actually be quite close to a real udelay() thing,
without the delay effect. It would probably more accurate to increase it
to loops_per_jiffy*10*HZ/16 and to call a __loop(16) thing, to get
closer timings. (but then some people would argue 'why dont you take the
lock as soon as it's released'.)
Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists