filedesc_sx patch (20070401a)
Robert Watson
rwatson at FreeBSD.org
Wed Apr 4 07:51:11 UTC 2007
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
More information about the freebsd-current
mailing list