From owner-freebsd-arch@FreeBSD.ORG Mon Mar 6 18:53:25 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 042F416A420; Mon, 6 Mar 2006 18:53:25 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D74D43D45; Mon, 6 Mar 2006 18:53:24 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k26IrM67019774; Mon, 6 Mar 2006 13:53:23 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-arch@freebsd.org Date: Mon, 6 Mar 2006 13:52:03 -0500 User-Agent: KMail/1.9.1 References: <35339.1141557488@critter.freebsd.dk> In-Reply-To: <35339.1141557488@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603061352.05452.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1315/Sun Mar 5 05:31:57 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED,AWL autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: arch@freebsd.org, Poul-Henning Kamp Subject: Re: wakeup idea... X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2006 18:53:25 -0000 X-List-Received-Date: Mon, 06 Mar 2006 18:53:25 -0000 On Sunday 05 March 2006 06:18, Poul-Henning Kamp wrote: > > Here is a possibly stupid idea. > > Historically sleep/wakeup have happened on a pointer which was just > a magic number. > > In many cases, this pointer is actually a relevant datastructure. > > Would it possibly be an optimization to make a variant of the > sleep/wakeup calls where the pointer points to an integer type which > contains non-zero if anybody is actually sleeping on that address ? > > Anybody up for a quick prototype ? It lives in sys/kern/kern_condvar.c void cv_signal(struct cv *cvp) { sleepq_lock(cvp); if (cvp->cv_waiters > 0) { cvp->cv_waiters--; sleepq_signal(cvp, SLEEPQ_CONDVAR, -1); } else sleepq_release(cvp); } -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org