NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Linux compat and swap



On Fri, Apr 24, 2020 at 10:18:10AM +0100, Sad Clouds wrote:
> On Fri, 24 Apr 2020 00:50:38 -0700
> "Greg A. Woods" <woods%planix.com@localhost> wrote:
> 
> > On the other hand the vm.*max percentages are just limits to how many
> > pages will be reclaimed from other uses when a given category faces
> > pressure from extensive and immediate use -- they do not set the
> > maximum use for a given category.  On my rsync backup host I normally
> > see 85% of pages allocated to file cache even though vm.filemax is
> > just 50.
> 
> But what is the value of vm.filemax? It tells the system what
> percentage of memory to steal from other uses, but this is counter
> productive, since by stealing from vm.anon and vm.exec it can result in
> swapping and extra disk I/O, which is what vm.filemax is trying to
> avoid in the first place, that is unnecessary disk I/O.
> 
> I think the behaviour needs fixing, i.e. if vm.filemax is about to push
> pages to swap, then it should stop.

Greg's description is far more accurate than mine, I was taking a very
simplistic view. Really, the min/max just provide a weighting or
priority for eviction, for each page type.

It really depends on use case. I remember relatively small shared Uni
UNIX systems with hundreds of users logged in, most idle, and their
processes all paged out to make room for active processes. Then there
are databases that want to fill memory with their own block cache,
ideally they use O_DIRECT so the file cache doesn't even come into
the picture. Then you have soft realtime or serving systems where
you don't want any paging, ever. And you mlock text pages at startup.
And you don't even run with swap configured.
(Yes, I've seen a watchdog thread that normally ticks every 100ms
start ticking once a minute because it had to continually page in
the handful of text pages it needed from a busy disk).

If you only want the filecache to consume "available" memory, then
set filemin & filemax to some small value.

-- 
Paul Ripke
"Great minds discuss ideas, average minds discuss events, small minds
 discuss people."
-- Disputed: Often attributed to Eleanor Roosevelt. 1948.


Home | Main Index | Thread Index | Old Index