kernel - per-thread fd cache, p_fd lock bypass
commit359499301cb3e32b532c88c41e7df5a36111392a
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 20 Apr 2018 15:44:32 +0000 (20 08:44 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 22 Apr 2018 00:50:11 +0000 (21 17:50 -0700)
tree82873c9e898fb918f2be05abc74cb615cfd9a407
parentdcf5173ca760ee08d704d08a8b5e30f30b0177ef
kernel - per-thread fd cache, p_fd lock bypass

* Implement a per-thread (fd,fp) cache.  Cache hits can keep fp's
  in a held state (avoiding the need to fhold()/fdrop() the ref count),
  and bypasses the p_fd spinlock.  This allows the file pointer structure
  to generally be shared across cpu caches.

* Can cache up to four descriptors in each thread, LRU.  This is the common
  case.  Highly threaded programs tend to focus work on a distinct
  file descriptors in each thread.

* One file descriptor can be cached in up to four threads.  This is
  a significant limitation, though relatively uncommon.  On a cache miss
  the code drops into the normal shared p_fd spinlock lookup.
21 files changed:
sys/dev/disk/iscsi/initiator/iscsi.c
sys/dev/disk/xdisk/xdisk.c
sys/kern/imgact_elf.c
sys/kern/kern_acl.c
sys/kern/kern_checkpoint.c
sys/kern/kern_descrip.c
sys/kern/kern_event.c
sys/kern/kern_exit.c
sys/kern/subr_diskiocom.c
sys/kern/sys_generic.c
sys/kern/sys_mqueue.c
sys/kern/uipc_syscalls.c
sys/kern/vfs_nlookup.c
sys/kern/vfs_syscalls.c
sys/netproto/smb/smb_dev.c
sys/sys/filedesc.h
sys/sys/thread.h
sys/vfs/hammer2/hammer2_ioctl.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/nfs/nfs_syscalls.c
sys/vm/vm_mmap.c