kernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf
commitd629916367683a6eed53be1506f361d512724496
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 22 Apr 2018 00:30:42 +0000 (21 17:30 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 22 Apr 2018 00:50:11 +0000 (21 17:50 -0700)
tree39f0b67514115f434af8377a9dd8b9669573d21c
parent7798395d91fff4e692c6c359bccce20c8372c8b9
kernel - Remove SMP bottlenecks on uidinfo, descriptors, and lockf

* Use an eventcounter and the per-thread fd cache to fix
  bottlenecks in checkfdclosed().  This will work well for
  the vast majority of applications and test benches.

* Batch holdfp*() operations on kqueue collections when implementing
  poll() and select().  This significant improves performance.
  Full scaling not yet achieved, however.

* Increase copyin item batching from 8 to 32 for select() and poll().

* Give the uidinfo structure a pcpu array to hold the posixlocks
  and openfiles count fields, with a rollup contained in the uidinfo
  structure itself.

  This removes numerous global bottlenecks related to open(),
  close(), dup*(), and lockf operations (posixlocks count).

  ui_openfiles will force a rollup on limit reached to be sure
  that the limit was actually reached.  ui_posixlocks stays fairly
  loose.  Each cpu rolls up generally only when the pcpu count exceeds
  +32 or goes below -32.

* Give the proc structure a pcpu array for the same counts, in order
  to properly support seteuid() and such.

* Replace P_ADVLOCK with a char field proc->p_advlock_flag, and
  remove token operations around the field.
13 files changed:
sys/kern/kern_descrip.c
sys/kern/kern_event.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_lockf.c
sys/kern/kern_resource.c
sys/kern/sys_generic.c
sys/sys/event.h
sys/sys/eventvar.h
sys/sys/file.h
sys/sys/filedesc.h
sys/sys/proc.h
sys/sys/resourcevar.h