kernel - per-thread fd cache, p_fd lock bypass

Operating Systems / DragonFlyBSD - Matthew Dillon [apollo.backplane.com] - 22 April 2018 00:50 EDT

- 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.

359499301c kernel - per-thread fd cache, p_fd lock bypass
sys/dev/disk/iscsi/initiator/iscsi.c | 4 +-
sys/dev/disk/xdisk/xdisk.c | 2 +-
sys/kern/imgact_elf.c | 5 +-
sys/kern/kern_acl.c | 10 +-
sys/kern/kern_checkpoint.c | 9 +-
sys/kern/kern_descrip.c | 551 ++++++++++++++++++++++++++++++-----
sys/kern/kern_event.c | 7 +-
sys/kern/kern_exit.c | 6 +
sys/kern/subr_diskiocom.c | 2 +-
sys/kern/sys_generic.c | 24 +-
sys/kern/sys_mqueue.c | 2 +-
sys/kern/uipc_syscalls.c | 72 +++--
sys/kern/vfs_nlookup.c | 3 +-
sys/kern/vfs_syscalls.c | 54 ++--
sys/netproto/smb/smb_dev.c | 2 +-
sys/sys/filedesc.h | 18 +-
sys/sys/thread.h | 18 +-
sys/vfs/hammer2/hammer2_ioctl.c | 2 +-
sys/vfs/hammer2/hammer2_vfsops.c | 2 +-
sys/vfs/nfs/nfs_syscalls.c | 2 +-
sys/vm/vm_mmap.c | 4 +-
21 files changed, 601 insertions(+), 198 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share