Re: AIM7 40% regression with 2.6.26-rc1

From: Matthew Wilcox
Date: Wed May 07 2008 - 14:01:16 EST


On Wed, May 07, 2008 at 10:55:26AM -0700, Linus Torvalds wrote:
> Hmm. I do agree that _cond_resched() looks a bit iffy, although in a safe
> way. It uses just
>
> !(preempt_count() & PREEMPT_ACTIVE)
>
> to see whether it can schedule, and it should probably use in_atomic()
> which ignores the kernel lock.
>
> But right now, that whole thing is disabled if PREEMPT is on anyway, so in
> effect (with my test patch, at least) cond_preempt() would just be a no-op
> if PREEMPT is on, even if BKL isn't preemptable.
>
> So it doesn't look buggy, but it looks like it might cause longer
> latencies than strictly necessary. And if somebody depends on
> cond_resched() to avoid some bad livelock situation, that would obviously
> not work (but that sounds like a fundamental bug anyway, I really hope
> nobody has ever written their code that way).

Funny you should mention it; locks.c uses cond_resched() assuming that
it ignores the BKL. Not through needing to avoid livelock, but it does
presume that other higher priority tasks contending for the lock will
get a chance to take it. You'll notice the patch I posted yesterday
drops the file_lock_lock around the call to cond_resched().

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/