Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2019 19:14:03 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352813 - head/sys/kern
Message-ID:  <201909271914.x8RJE3u7046957@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Fri Sep 27 19:14:03 2019
New Revision: 352813
URL: https://svnweb.freebsd.org/changeset/base/352813

Log:
  cache: decrease ncnegfactor to 5
  
  The current mechanism is bogus in several ways:
  - the limit is a percentage of total entries added, which means negative
  entries get evicted all the time even if there are plenty of resources
  - evicting code is almost not concurrent, which makes it unable to
  remove entries fast enough when doing something as simple as -j 104
  buildworld
  - there is no support for performing mass removal if necessary
  
  Vast majority of negative entries never get any hits. Only evicting
  them when the filesystem demands it results in a significant growth of
  the namecache with almost no improvement in the hit ratio.
  
  Sample result about afer 90 minutes of poudriere -j 104:
  
             current    no evict   % of the original
  numneg     219737     2013157    916
  numneghits 266711906  263544562  98 [1]
  
  [1] this may look funny but there is a certain dose of variation to the
  build
  
  The number was chosen as something which mostly eliminates spurious
  evictions during lighter workloads but still keeps the total at bay.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Fri Sep 27 19:13:22 2019	(r352812)
+++ head/sys/kern/vfs_cache.c	Fri Sep 27 19:14:03 2019	(r352813)
@@ -200,7 +200,7 @@ static __read_mostly LIST_HEAD(nchashhead, namecache) 
 static u_long __read_mostly	nchash;			/* size of hash table */
 SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0,
     "Size of namecache hash table");
-static u_long __read_mostly	ncnegfactor = 12; /* ratio of negative entries */
+static u_long __read_mostly	ncnegfactor = 5; /* ratio of negative entries */
 SYSCTL_ULONG(_vfs, OID_AUTO, ncnegfactor, CTLFLAG_RW, &ncnegfactor, 0,
     "Ratio of negative namecache entries");
 static u_long __exclusive_cache_line	numneg;	/* number of negative entries allocated */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909271914.x8RJE3u7046957>