Re: [RFC][PATCH 4/5] memory_pressure_notify() caller

From: Daniel Spång
Date: Tue Jan 15 2008 - 17:55:31 EST


Hi,

On 1/15/08, KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> the notification point to happen whenever the VM moves an
> anonymous page to the inactive list - this is a pretty good indication
> that there are unused anonymous pages present which will be very likely
> swapped out soon.

> + /* deal with the case where there is no
> + * swap but an anonymous page would be
> + * moved to the inactive list.
> + */
> + if (!total_swap_pages && reclaim_mapped &&
> + PageAnon(page))
> + inactivated_anon = 1;

As you know I have had some concerns regarding a too early
notification in a swapless system.

I did a test with a populated page cache in a swapless system:

$ cat /bigfile > /dev/null # populate page cache
$ cat /proc/meminfo
MemTotal: 1037040 kB
MemFree: 113976 kB
Buffers: 1068 kB
Cached: 907552 kB
SwapCached: 0 kB
Active: 11116 kB
Inactive: 903968 kB
HighTotal: 130992 kB
HighFree: 252 kB
LowTotal: 906048 kB
LowFree: 113724 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 36 kB
Writeback: 0 kB
AnonPages: 6484 kB
Mapped: 1216 kB
Slab: 4024 kB
SReclaimable: 864 kB
SUnreclaim: 3160 kB
PageTables: 444 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 518520 kB
Committed_AS: 18816 kB
VmallocTotal: 114680 kB
VmallocUsed: 904 kB
VmallocChunk: 113672 kB

Start to allocate memory, 10 MB every second, exit on notification.

$ cat /proc/meminfo # just after notification
MemTotal: 1037040 kB
MemFree: 123468 kB
Buffers: 876 kB
Cached: 897976 kB
SwapCached: 0 kB
Active: 12984 kB
Inactive: 892332 kB
HighTotal: 130992 kB
HighFree: 1064 kB
LowTotal: 906048 kB
LowFree: 122404 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 6484 kB
Mapped: 1220 kB
Slab: 4012 kB
SReclaimable: 864 kB
SUnreclaim: 3148 kB
PageTables: 448 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 518520 kB
Committed_AS: 18816 kB
VmallocTotal: 114680 kB
VmallocUsed: 904 kB
VmallocChunk: 113672 kB

The notification fires after only ~100 MB allocated, i.e., when page
reclaim is beginning to nag from page cache. Isn't this a bit early?
Repeating the test with swap enabled results in a notification after
~600 MB allocated, which is more reasonable and just before the system
starts to swap.

Cheers,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/