From owner-freebsd-threads@FreeBSD.ORG Tue Jul 6 20:14:34 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3777516A4CE for ; Tue, 6 Jul 2004 20:14:34 +0000 (GMT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id BDFC043D31 for ; Tue, 6 Jul 2004 20:14:33 +0000 (GMT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.12.10/8.12.10) with ESMTP id i66KEVqM013859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 6 Jul 2004 16:14:31 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.12.9p2/8.12.9/Submit) id i66KEQsX017769; Tue, 6 Jul 2004 16:14:26 -0400 (EDT) (envelope-from gallatin) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16619.2082.399880.649617@grasshopper.cs.duke.edu> Date: Tue, 6 Jul 2004 16:14:26 -0400 (EDT) To: Julian Elischer In-Reply-To: References: <16618.52660.343754.933037@grasshopper.cs.duke.edu> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid cc: freebsd-threads@freebsd.org Subject: Re: pthread switch (was Odd KSE panic) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2004 20:14:34 -0000 Julian Elischer writes: > > > On Tue, 6 Jul 2004, Andrew Gallatin wrote: > > > > > FWIW, inserting a pthread_yield() just before the ioctl call in the > > worker thread speeds things up quite a bit (100us -> 73us) in > > combination with kern.threads.virtual_cpu=1. > > what about with kern.threads.virtual_cpu untouched? > and what about with the hlt sysctl? kern.threads.virtual_cpu=2 machdep.cpu_idle_hlt=1 no yeild 123.6us yeild 116.8us kern.threads.virtual_cpu=2 machdep.cpu_idle_hlt=0 no yield 111.9 yield 112.9 kern.threads.virtual_cpu=1 machdep.cpu_idle_hlt=1 no yeild 100.8 yeild 75.0 kern.threads.virtual_cpu=1 machdep.cpu_idle_hlt=0 no yield 93.9 ield 67.9 > does your worker thread loop to check if there is more work before > waiting to be notified? Yes. He takes a mutex, loops over all completed events, sending pthread_signals as required, then releases the mutex and sleeps via an ioctl. Drew