Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jan 2006 15:21:50 +0800
From:      prime <guomingyan@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   An idea of remove MUTEX_WAKE_ALL
Message-ID:  <1fa17f810512312321n619291a0l59473e11af5cb147@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi hackers,
   I have an idea about remove the kernel option MUTEX_WAKE_ALL.
   When we unlock the mutex(in _mtx_unlock_sleep),we can directly
give the lock to the first thread waiting on the turnstile.And a
thread gets the mutex after he returned from turnstile_wait so he
can simply jump out the _obtain_lock loop in _mtx_lock_sleep.
This makes a mutex always be owned by a thread when there are threads
waiting on the turnstile,so priority inheritance can work now.
   This idea need only a few changes in kern/kern_mutex.c .But when
NO_ADAPTIVE_MUTEXS not set,it makes threads that spinning on other CPU
to get the mutex have to spin for a long time,and this makes the short
term mutex more expensive(maybe should use spin mutex instead).

What do think about the idea? Thanks.

--
Three passions, simple but overwhelmingly strong, have governed my life:
the longing for love, the search for knowledge, and unbearable pity for
the suffering of mankind.
                         ---------Bertrand Russell



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1fa17f810512312321n619291a0l59473e11af5cb147>