From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 1 07:21:51 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D222F16A41F for ; Sun, 1 Jan 2006 07:21:51 +0000 (GMT) (envelope-from guomingyan@gmail.com) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4ACF543D45 for ; Sun, 1 Jan 2006 07:21:51 +0000 (GMT) (envelope-from guomingyan@gmail.com) Received: by xproxy.gmail.com with SMTP id t12so230529wxc for ; Sat, 31 Dec 2005 23:21:50 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=qqTsGNV7yx98E3RMcEcbFu6uVZ4Fw0ljeng+cyt/uBq7P9Z9ZxTgtsNcWAMpTgHL3ziA6LUetZMPoJ0BV+fobu2dnhp5boAWABsUIY0Zs558etNwBAzr0LrzNjls3rddCFn6U3w00sNW+9UZwgEQdELZRGGtayYNoO5gc0rFgG0= Received: by 10.70.26.8 with SMTP id 8mr11262783wxz; Sat, 31 Dec 2005 23:21:51 -0800 (PST) Received: by 10.70.39.18 with HTTP; Sat, 31 Dec 2005 23:21:50 -0800 (PST) Message-ID: <1fa17f810512312321n619291a0l59473e11af5cb147@mail.gmail.com> Date: Sun, 1 Jan 2006 15:21:50 +0800 From: prime To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: An idea of remove MUTEX_WAKE_ALL X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Jan 2006 07:21:51 -0000 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