fs: recreate kernelNodeIds & stableAttrs maps when they shrink
Maps do not free all memory when elements get deleted ( https://github.com/golang/go/issues/20135 ). As a workaround, we recreate our two big maps (kernelNodeIds & stableAttrs) when they have shrunk dramatically (100 x smaller). Benchmarkung with loopback (go version go1.16.2 linux/amd64) shows: Before this change: Step VmRSS (kiB) ----- ----------- Fresh mount 4000 ls -R 500k files 271100 after drop_cache 336448 wait ~ 3 minutes 101588 After: Step VmRSS (kiB) ----- ----------- Fresh mount 4012 ls -R 500k files 271100 after drop_cache 31528 Results for gocryptfs are similar. Has survived xfstests via gocryptfs. Fixes: https://github.com/rfjakob/gocryptfs/issues/569 Change-Id: Idcae1ab953270516735839a034d586717647b8db
Showing
Please register or sign in to comment