In some rare case, during an heavy and constant load of several minutes, my arc is almost emptied.
After digging in the code of arc.c, when the variable needfree is setted by arc_lowmem, it is cleared only when we reach the test "if (arc_size <= arc_c || evicted == 0)" in arc_reclaim_thread().
But in my case, the test seems to not be true for a long period, arc_size remain superior to arc_c (because I have a lot of IO) and arc_adjust() is always succeding to free some bytes.
You can find here a screen capture of the stats of the arc during the bug https://elyzion.net/~nikita/arc_reclaim.png (in the interactive graph you can see that arc_size is always a little bit bigger than arc_c). Unfortunately I had not dtrace enabled the last time I encountered this bug.
I was also thinking about, instead of decrementing needfree, to wait that we have freed at least arc_c >> arc_no_grow_shift bytes to reset needfree to 0.
Notes:
- In illumos, needfree is a tunable setted directly by their vm_page.c so they don't have this issue.
- I don't have tested it extensively enough, and I'm pretty new in ZFS.