ref: 19189681847a2939f196d430cb6a820e331b11d5
parent: 461ba8aaa0b2eb33e36765551c70a9c16aa39b09
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jul 13 08:53:15 EDT 2025
kernel: limit fscache to 256MB Reclaiming pages takes too long when we sink all our idle pages into the fscache, yielding to lockloop prints during relcaim. Limit the size of the fscache to 256MB to have more predictable behaviour.
--- a/sys/src/9/port/cache.c
+++ b/sys/src/9/port/cache.c
@@ -9,10 +9,12 @@
{
NHASH = 128,
NFILE = 4093, /* should be prime */
- MAXCACHE = 8*1024*1024,
-
+ MAXCACHE = 8*MB, /* per file */
MAPBITS = 8*sizeof(ulong),
NBITMAP = (PGROUND(MAXCACHE)/BY2PG + MAPBITS-1) / MAPBITS,
+
+ /* maximum number pages in fscache image */
+ TOTALPAGES = (256*MB)/BY2PG,
};
/* devmnt.c: parallel read ahread implementation */
@@ -425,6 +427,8 @@
invalidate(m, offset + pn*BY2PG, len);
break;
}
+ if(fscache.pgref > TOTALPAGES)
+ pagereclaim(&fscache);
p = newpage(0, nil, pn*BY2PG);
p->daddr = cacheaddr(m, pn);
cachedel(&fscache, p->daddr);
--
⑨