From owner-freebsd-current@FreeBSD.ORG Wed Jun 21 20:19:29 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8336416A47F; Wed, 21 Jun 2006 20:19:29 +0000 (UTC) (envelope-from jd@ugcs.caltech.edu) Received: from groat.ugcs.caltech.edu (groat.ugcs.caltech.edu [131.215.176.110]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4EF6E43D46; Wed, 21 Jun 2006 20:19:29 +0000 (GMT) (envelope-from jd@ugcs.caltech.edu) Received: by groat.ugcs.caltech.edu (Postfix, from userid 3640) id 201D75880B; Wed, 21 Jun 2006 13:19:27 -0700 (PDT) Date: Wed, 21 Jun 2006 13:19:27 -0700 From: Paul Allen To: Robert Watson Message-ID: <20060621201927.GJ28128@groat.ugcs.caltech.edu> References: <20060612054115.GA42379@xor.obsecurity.org> <20060621183543.GC82074@funkthat.com> <20060621194412.N8526@fledge.watson.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060621194412.N8526@fledge.watson.org> Sender: jd@ugcs.caltech.edu Cc: current@freebsd.org Subject: Re: FILEDESC_LOCK() implementation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jun 2006 20:19:29 -0000 >From Robert Watson , Wed, Jun 21, 2006 at 07:46:33PM +0100: > I would optimize very carefully here, the trade-offs are tricky, and we may > find that by making locking more complex, we cause cache problems, increase > lock hold periods, etc, even if we decrease contention. I've wondered a > bit about a model where we loan fd's to threads to optimize repeated access > to the same fd by the same thread, but this mostly makes sense in the > context of a 1:1 model rather than an m:n model. I apologize for not understanding all of the uses of the FILEDESC lock but, isn't the more obvious partitioning per-cpu: each cpu may allocate from a range of fd, which cpu cache used depends on where the thread happens to be running. When closing a fd, it is returned to the local (possibly different cpu cache). A watermark is used to generate an IPI message to rebalance the caches as needed.