From owner-freebsd-current@FreeBSD.ORG Wed Apr 4 07:51:10 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EBFCC16A406; Wed, 4 Apr 2007 07:51:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id C0C1613C46C; Wed, 4 Apr 2007 07:51:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 5479846DE2; Wed, 4 Apr 2007 03:51:10 -0400 (EDT) Date: Wed, 4 Apr 2007 03:51:10 -0400 (EDT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Hans Petter Selasky In-Reply-To: <200704040942.08839.hselasky@c2i.net> Message-ID: <20070404034930.W25236@fledge.watson.org> References: <20070401155910.O75869@fledge.watson.org> <20070403175953.A25236@fledge.watson.org> <200704040942.08839.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org, performance@freebsd.org, current@freebsd.org, Andrzej Tobola Subject: Re: filedesc_sx patch (20070401a) 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, 04 Apr 2007 07:51:11 -0000 On Wed, 4 Apr 2007, Hans Petter Selasky wrote: > Just a small comment: > > @@ -60,10 +60,7 @@ > u_short fd_cmask; /* mask for file creation */ > u_short fd_refcnt; /* thread reference count */ > u_short fd_holdcnt; /* hold count on structure + mutex */ > - > - struct mtx fd_mtx; /* protects members of this struct */ > - int fd_locked; /* long lock flag */ > - int fd_wanted; /* "" */ > + struct sx fd_sx; /* protects members of this struct */ > struct kqlist fd_kqlist; /* list of kqueues on this filedesc */ > int fd_holdleaderscount; /* block fdfree() for shared close() */ > int fd_holdleaderswakeup; /* fdfree() needs wakeup */ > > Maybe it is better if you order the elements by size. Then you don't waste > so many extra bytes on platforms where the fields must be aligned. This seems reasonable; I'll merge the patch as-is first, minimizing the patch size of the change against filedesc.h, and then investigate what you suggest as a followup. Thanks for the comment! Generally speaking, we probably should be doing a structure size/layout review for things like in-memory inodes, vnodes, sockets, file descriptors, files, threads, etc, where small changes in memory overhead can make significant overall changes in memory use and cache efficiency. Robert N M Watson Computer Laboratory University of Cambridge