From owner-cvs-all@FreeBSD.ORG Mon Nov 26 22:37:35 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C26C516A41A; Mon, 26 Nov 2007 22:37:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B0A6413C458; Mon, 26 Nov 2007 22:37:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lAQMbZJo052709; Mon, 26 Nov 2007 22:37:35 GMT (envelope-from attilio@repoman.freebsd.org) Received: (from attilio@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lAQMbZrj052708; Mon, 26 Nov 2007 22:37:35 GMT (envelope-from attilio) Message-Id: <200711262237.lAQMbZrj052708@repoman.freebsd.org> From: Attilio Rao Date: Mon, 26 Nov 2007 22:37:35 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/kern kern_mutex.c kern_rwlock.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2007 22:37:35 -0000 attilio 2007-11-26 22:37:35 UTC FreeBSD src repository Modified files: sys/kern kern_mutex.c kern_rwlock.c Log: Simplify the adaptive spinning algorithm in rwlock and mutex: currently, before to spin the turnstile spinlock is acquired and the waiters flag is set. This is not strictly necessary, so just spin before to acquire the spinlock and to set the flags. This will simplify a lot other functions too, as now we have the waiters flag set only if there are actually waiters. This should make wakeup/sleeping couplet faster under intensive mutex workload. This also fixes a bug in rw_try_upgrade() in the adaptive case, where turnstile_lookup() will recurse on the ts_lock lock that will never be really released [1]. [1] Reported by: jeff with Nokia help Tested by: pho, kris (earlier, bugged version of rwlock part) Discussed with: jhb [2], jeff MFC after: 1 week [2] John had a similar patch about 6.x and/or 7.x about mutexes probabilly Revision Changes Path 1.201 +41 -29 src/sys/kern/kern_mutex.c 1.32 +72 -112 src/sys/kern/kern_rwlock.c