From owner-freebsd-arch@FreeBSD.ORG Wed Jul 4 01:16:08 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D845816A400 for ; Wed, 4 Jul 2007 01:16:08 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id A28CD13C484 for ; Wed, 4 Jul 2007 01:16:08 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.101] (c-71-231-138-78.hsd1.or.comcast.net [71.231.138.78]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id l641G6Or092417 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO) for ; Tue, 3 Jul 2007 21:16:07 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Tue, 3 Jul 2007 18:15:41 -0700 (PDT) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: arch@freebsd.org In-Reply-To: <20070702230728.E552@10.0.0.1> Message-ID: <20070703181242.T552@10.0.0.1> References: <20070702230728.E552@10.0.0.1> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: Fine grain select locking. 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: Wed, 04 Jul 2007 01:16:08 -0000 Here is an update that avoids the malloc per fd when there are no collisions. This unfortunately adds 64bytes to every socket in the system. This is less than 10% of the size of the socket. Vnodes only allocate their selinfo structures on demand so this does not cause a per-file overhead. This was suggested by Peter. This patch also uses a vm zone for the selfd structures. I can shrink them slightly by using a SLIST in one case vs TAILQ as well. http://people.freebsd.org/~jeff/select2.diff Thanks, Jeff On Mon, 2 Jul 2007, Jeff Roberson wrote: > I have a diff which makes the following improvements to select: > > 1) Per-thread wait channel rather than global select wait channel. > 2) Per-thread select lock. > 3) Rescan after sleep scans only descriptors which have come active. > 4) No exposed select internals. > 5) selwakeuppri() works again. > 6) No thread_lock()ing in select, no TDF_SELECT required. > 7) No more collisions. > > This is based on an approach from Alfred with some locking and rescan > improvements by me. It only required changing select users in cases where > they assumed only one thread could select at a time. > > The unfortunate cost of this patch is that a descriptor per select fd must be > allocated to track individual threads. This is what allows us to know which > descriptor has fired an event and allows us to use per-thread locking etc. > > The one thing I haven't fixed is netsmb and netncp which both have some wonky > select implementation that could be replaced with kern_select(). That could > be done seperately from this patch but is required for this to go in. > > http://people.freebsd.org/~jeff/select.diff > > Comments and suggestions welcome. > > Thanks, > Jeff > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org" >