Re: [PATCH -mm] vmscan: protect a fraction of file backed mapped pages from reclaim

KOSAKI Motohiro
2009-05-13T00:46:11Z

> All these expiration modifications do not take into account that a desktop
> may sit idle for hours while some other things run in the background (like
> backups at night or updatedb and other maintenance things). This still
> means that the desktop will be usuable in the morning.

Have you seen this phenomenom?
I always use linux desktop for development. but I haven't seen it.
perhaps I have no luck. I really want to know reproduce way.

Please let me know reproduce way.

> I have had some success with a patch that protects a pages in the file
> cache from being unmapped if the mapped pages are below a certain
> percentage of the file cache. Its another VM knob to define the percentage
> though.
>
>
> Subject: Do not evict mapped pages
>
> It is quite annoying when important executable pages of the user interface
> are evicted from memory because backup or some other function runs and no one
> is clicking any buttons for awhile. Once you get back to the desktop and
> try to click a link one is in for a surprise. It can take quite a long time
> for the desktop to recover from the swap outs.
>
> This patch ensures that mapped pages in the file cache are not evicted if there
> are a sufficient number of unmapped pages present. A similar technique is
> already in use under NUMA for zone reclaim. The same method can be used to
> protect mapped pages from reclaim.

note: (a bit offtopic)

some Nehalem machine has long node distance and enabled zone reclaim mode.
but it cause terrible result.

it only works on large numa.

>
> The percentage of file backed pages protected is set via
> /proc/sys/vm/file_mapped_ratio. This defaults to 20%.

Why do you think typical mapped ratio is less than 20% on desktop machine?

Some desktop component (e.g. V4L, GEM, some game) use tons mapped page.
but in the other hand, another some desktop user only use browser.
So we can't assume typical mapped ratio on desktop, IMHO.

Plus, typical desktop user don't set any sysctl value.

key point is access-once vs access-many.
I don't think mapped ratio is good approximation value.