Re: filedesc_sx patch (20070401a)

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Wed, 4 Apr 2007 03:51:10 -0400 (EDT)
On Wed, 4 Apr 2007, Hans Petter Selasky wrote:

> Just a small comment:
>
> _at__at_ -60,10 +60,7 _at__at_
> 	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
Received on Wed Apr 04 2007 - 05:51:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC