kernel - Fix bugs and refactor namecache cleaning code
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 28 Oct 2017 23:04:58 +0000 (16:04 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 28 Oct 2017 23:04:58 +0000 (16:04 -0700)
commitbf3f67a7c2acae2b8e097b00c9e13bc4241dfebb
tree8776626269a5a09a35857faadac4a785f474a4b5
parentc3c895a62193e0eb34749eb6e20a7957eb66ea40
kernel - Fix bugs and refactor namecache cleaning code

* Refactor the cleaning code.  For positive namecache entries,
  track based on NCHHASH linkages rather than v_namecache linkages.
  Also maintain a count of freeable (leaf) entries and use that
  in the _cache_cleanpos() code.

  This should hopefully fix a bug where the system can get stuck
  constantly calling _cache_cleanpos() in situations where there
  are not any freeable entries.

* Refactor the negative namecache tracking code.  Move to a per-cpu
  structure where entries are made based on the current cpu and removed
  based on the recorded cpu.  Refactor the cleaning code to iterate
  the cpu list on a per-call basis which should hopefully allow multiple
  cpus to clean the ncneg lists concurrently.

  This reduces a SMP bottleneck, but does not deal with cache
  ping-ponging issues on related structures.

Reported-by: ftigeot
sys/kern/kern_clock.c
sys/kern/vfs_cache.c
sys/sys/namecache.h