cvs commit: src/sys/compat/svr4 svr4_stream.c src/sys/dev/streams streams.c src/sys/fs/devfs devfs_vnops.c src/sys/fs/fifofs fifo_vnops.c src/sys/kern kern_descrip.c kern_event.c sys_generic.c sys_pipe.c uipc_mqueue.c uipc_syscalls.c ...

Jeff Roberson jroberson at chesapeake.net
Mon Dec 31 00:49:06 UTC 2007


On Sun, 30 Dec 2007, Jeff Roberson wrote:

> jeff        2007-12-30 01:42:15 UTC
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/compat/svr4      svr4_stream.c
>    sys/dev/streams      streams.c
>    sys/fs/devfs         devfs_vnops.c
>    sys/fs/fifofs        fifo_vnops.c
>    sys/kern             kern_descrip.c kern_event.c sys_generic.c
>                         sys_pipe.c uipc_mqueue.c uipc_syscalls.c
>                         uipc_usrreq.c vfs_syscalls.c vfs_vnops.c
>    sys/netgraph         ng_socket.c
>    sys/opencrypto       cryptodev.c
>    sys/sys              file.h unpcb.h
>  Log:
>  Remove explicit locking of struct file.


I got a few questions about this in private so I'll elaborate a bit.  This 
more than halves the number of atomic operations that are normally done, 
shrinks the size of struct file, and eliminates some global contention 
points.  Previously we used a mtx pool to protect the ref count, so we 
would lock, ref, unlock, do something, lock unref, unlock.  Now that's 
only two atomics and no real contention.  This helps performance for 
multithreaded programs and non multi-threaded programs.

Cheers,
Jeff

>   - Introduce a finit() which is used to initailize the fields of struct file
>     in such a way that the ops vector is only valid after the data, type,
>     and flags are valid.
>   - Protect f_flag and f_count with atomic operations.
>   - Remove the global list of all files and associated accounting.
>   - Rewrite the unp garbage collection such that it no longer requires
>     the global list of all files and instead uses a list of all unp sockets.
>   - Mark sockets in the accept queue so we don't incorrectly gc them.
>
>  Tested by:      kris, pho
>
>  Revision  Changes    Path
>  1.63      +0 -4      src/sys/compat/svr4/svr4_stream.c
>  1.57      +1 -6      src/sys/dev/streams/streams.c
>  1.151     +1 -4      src/sys/fs/devfs/devfs_vnops.c
>  1.139     +1 -4      src/sys/fs/fifofs/fifo_vnops.c
>  1.315     +67 -105   src/sys/kern/kern_descrip.c
>  1.115     +11 -23    src/sys/kern/kern_event.c
>  1.161     +4 -8      src/sys/kern/sys_generic.c
>  1.195     +2 -12     src/sys/kern/sys_pipe.c
>  1.26      +11 -12    src/sys/kern/uipc_mqueue.c
>  1.261     +5 -28     src/sys/kern/uipc_syscalls.c
>  1.208     +177 -239  src/sys/kern/uipc_usrreq.c
>  1.445     +15 -19    src/sys/kern/vfs_syscalls.c
>  1.254     +9 -5      src/sys/kern/vfs_vnops.c
>  1.84      +1 -1      src/sys/netgraph/ng_socket.c
>  1.36      +1 -6      src/sys/opencrypto/cryptodev.c
>  1.74      +31 -60    src/sys/sys/file.h
>  1.23      +8 -1      src/sys/sys/unpcb.h
>


More information about the cvs-all mailing list