Re: ADAPTIVE_GIANT

From: Bernd Walter <ticso(at)cicely12.cicely.de>
Date: Wed, 30 May 2007 21:16:13 +0200

On Wed, May 30, 2007 at 07:46:27PM +0200, Manfred Lotz wrote:
> Hi all,
> Ich hätte mal eine Frage zu:
>
> options ADAPTIVE_GIANT # Giant mutex is adaptive.
>
> Dies scheint der Default zu sein. Jedoch steht im Handbuch:
>
> Giant is the name of a mutual exclusion mechanism (a sleep mutex) that
> protects a large set of kernel resources. Today, this is an
> unacceptable performance bottleneck which is actively being replaced
> with locks that protect individual resources. The ADAPTIVE_GIANT
> option causes Giant to be included in the set of mutexes adaptively
> spun on. That is, when a thread wants to lock the Giant mutex, but it
> is already locked by a thread on another CPU, the first thread will
> keep running and wait for the lock to be released. Normally, the
> thread would instead go back to sleep and wait for its next chance to
> run. If you are not sure, leave this in.
>
>
> Da ich nicht sicher bin, sollte ich die Option also lassen. :-)
>
>
> Ich würde aber gerne verstehen, ob es vielleicht doch Sinn macht es
> weg zulassen. Man könnte aus diesem Text schliessen, dass man ihn
> bei einem Ein-Prozessor System nicht (mehr) benötigt.

Bei 1-CPU Systemen hat die Optione keine Auswirkung.
Die Option bewirkt, dass die CPU nur dann ins spinning verfällt, wenn
eine andere CPU den Thread ausführt, welche den Mutex besitzt, also
eine gute Chance besteht, das eine andere CPU den kurzfristig freigibt.
Auf einem UP-System also niemals.
Aber eigendlich steht genau das schon in deinem Zitat...

Es wird ohne SMP auch gar nicht erst eincompiliert, und zwar für alle
Mutex, nicht nur für GIANT.
In sys/kern/kern_mutex.c:
#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES)
#define ADAPTIVE_MUTEXES
#endif

-- 
B.Walter                http://www.bwct.de      http://www.fizon.de
bernd(at)bwct.de           info(at)bwct.de            support(at)fizon.de
To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Wed 30 May 2007 - 21:17:38 CEST

search this site