From owner-cvs-all@FreeBSD.ORG Sat Oct 30 04:51:23 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC15516A4CE; Sat, 30 Oct 2004 04:51:23 +0000 (GMT) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7AD843D60; Sat, 30 Oct 2004 04:51:23 +0000 (GMT) (envelope-from alc@cs.rice.edu) Received: from localhost (calypso.cs.rice.edu [128.42.1.127]) by cs.rice.edu (Postfix) with ESMTP id 57DCF4AA48; Fri, 29 Oct 2004 23:51:23 -0500 (CDT) Received: from cs.rice.edu ([128.42.1.30]) by localhost (calypso.cs.rice.edu [128.42.1.127]) (amavisd-new, port 10024) with LMTP id 08476-01-24; Fri, 29 Oct 2004 23:51:22 -0500 (CDT) Received: by cs.rice.edu (Postfix, from userid 19572) id E12524AA42; Fri, 29 Oct 2004 23:51:22 -0500 (CDT) Date: Fri, 29 Oct 2004 23:51:22 -0500 From: Alan Cox To: Mike Silbersack Message-ID: <20041030045122.GK16728@cs.rice.edu> References: <200410291910.i9TJAlNf089795@repoman.freebsd.org> <200410291549.17355.jhb@FreeBSD.org> <20041029174131.A6530@odysseus.silby.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041029174131.A6530@odysseus.silby.com> User-Agent: Mutt/1.4.2i X-Virus-Scanned: by amavis-20030616-p7 at cs.rice.edu cc: Alan Cox cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: John Baldwin Subject: Re: cvs commit: src/sys/i386/i386 pmap.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 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: Sat, 30 Oct 2004 04:51:24 -0000 On Fri, Oct 29, 2004 at 05:51:30PM -0500, Mike Silbersack wrote: > [snip] > > Instead, how about this - could per-CPU mutexes be implemented? In that > mode, mutexes wouldn't use atomic ops, because they'd only ever be used by > a specific processor, thereby eliminating the need for atomic ops. The > second modification would be that they set a per-CPU flag somewhere which > would tell the scheduler not to reawaken the sleeping kernel thread unless > it was on the same CPU it started on. In a word, yes. Start with the _get_sleep_lock macro from sys/mutex.h and make two changes: (1) inline the implementation of sched_pin() just before the _obtain_lock() call and (2) replace the current implementation of _obtain_lock() with a new implementation that is atomic with respect to interrupts but not other processors. A similar approach could be applied to unlock, starting with the _rel_sleep_lock() macro. Alan