Re: [PATCH] Yielding processor resources during lock contention
From: Nick Piggin
Date: Sun Sep 12 2004 - 00:32:49 EST
Zwane Mwaikambo wrote:
On Sat, 11 Sep 2004, Andrew Morton wrote:
Now, maybe Paul has tied himself into sufficiently tangly locking knots
that in some circumstances he needs to spin on the lock and cannot schedule
away. But he can still use a semaphore and spin on down_trylock.
Confused by all of this.
Well currently it just enables preempt and spins like a mad man until the
lock is free. The idea is to allow preempt to get some scheduling done
during the spin.. But! if you accept this patch today, you get the
i386 version which will allow your processor to halt until a write to the
lock occurs whilst allowing interrupts to also trigger the preempt
scheduling, much easier on the caches.
That's the idea though isn't it? If your locks are significantly more
expensive than a context switch and associated cache trashing, use a
semaphore, hypervisor or no.
I presume the hypervisor switch much incur the same sorts of costs as
a context switch?
-
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/