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

From: Daniel Spång
Date: Wed Jan 16 2008 - 06:04:16 EST


On 1/16/08, KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> Hi Daniel
>
> > > > 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.
> > >
> > > Your issue may have more to do with the fact that the
> > > highmem zone is 128MB in size and some balancing issues
> > > between __alloc_pages and try_to_free_pages.
> >
> > I don't think so. I ran the test again without highmem and noticed the
> > same behaviour:
>
> Thank you for good point out!
> Could you please post your test program and reproduced method?

Sure:

1. Fill almost all available memory with page cache in a system without swap.
2. Run attached alloc-test program.
3. Notification fires when page cache is reclaimed.

Example:

$ cat /bigfile > /dev/null
$ cat /proc/meminfo
MemTotal: 895876 kB
MemFree: 94272 kB
Buffers: 884 kB
Cached: 782868 kB
SwapCached: 0 kB
Active: 15356 kB
Inactive: 778000 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 895876 kB
LowFree: 94272 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 9624 kB
Mapped: 1352 kB
Slab: 4220 kB
SReclaimable: 1168 kB
SUnreclaim: 3052 kB
PageTables: 528 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 447936 kB
Committed_AS: 28988 kB
VmallocTotal: 122872 kB
VmallocUsed: 904 kB
VmallocChunk: 121864 kB
$ ./test-alloc
---------
Got notification, allocated 90 MB
$ cat /proc/meminfo
MemTotal: 895876 kB
MemFree: 101960 kB
Buffers: 888 kB
Cached: 775200 kB
SwapCached: 0 kB
Active: 15356 kB
Inactive: 770336 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 895876 kB
LowFree: 101960 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 28 kB
Writeback: 0 kB
AnonPages: 9624 kB
Mapped: 1352 kB
Slab: 4224 kB
SReclaimable: 1168 kB
SUnreclaim: 3056 kB
PageTables: 532 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 447936 kB
Committed_AS: 28988 kB
VmallocTotal: 122872 kB
VmallocUsed: 904 kB
VmallocChunk: 121864 kB

Attachment: alloc-test.c
Description: Binary data