kernel - Attempt to fix high vnlru cpu use
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 20 Mar 2018 01:39:21 +0000 (18:39 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 20 Mar 2018 01:39:21 +0000 (18:39 -0700)
commite83d5c121c899edad9e4cab9fee4465c6d39d04c
tree74ff9c2e40943e803f41329755f27413e2c4823f
parentb276d6fe06e6cb191f75486f1608f0dbc5822485
kernel - Attempt to fix high vnlru cpu use

* In certain situations _cache_cleanpos() gets into a livelock
  of some sort.  It is limited by a counter but the livelock creates
  havoc when it happens.

* It appears that _cache_cleanpos() can get into a situation where
  the head element of all available nchashtbl[] slots is not freeable
  (e.g. due to having multiple refs).  When this occurs, trailing
  elements in the chained hash table cannot be recycled.

  nchashtbl[] is typically very large, so this situation does not
  happen very often.  There are usually plenty of entries to pick
  away at.  However, it looks like situations can develop where
  enough entries get into this masked state that the hysteresis is
  unable to complete, resulting in a cpubound loop.

* Refactor the chained list from LIST to TAILQ and modify the
  _cache_cleanpos() function to cycle ncp's to the end of the
  list before trying to zap them.  If the zap fails, the next
  iteration will encounter a different head.

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