Re: [PATCH]vmscan: handle underflow for get_scan_ratio

Shaohua Li
2010-03-30T06:32:40Z

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

On Tue, 2010-03-30 at 14:08 +0800, KOSAKI Motohiro wrote:
> Hi
>
> > Commit 84b18490d1f1bc7ed5095c929f78bc002eb70f26 introduces a regression.
> > With it, our tmpfs test always oom. The test has a lot of rotated anon
> > pages and cause percent[0] zero. Actually the percent[0] is a very small
> > value, but our calculation round it to zero. The commit makes vmscan
> > completely skip anon pages and cause oops.
> > An option is if percent[x] is zero in get_scan_ratio(), forces it
> > to 1. See below patch.
> > But the offending commit still changes behavior. Without the commit, we scan
> > all pages if priority is zero, below patch doesn't fix this. Don't know if
> > It's required to fix this too.
>
> Can you please post your /proc/meminfo
attached.
> and reproduce program? I'll digg it.
our test is quite sample. mount tmpfs with double memory size and store several
copies (memory size * 2/G) of kernel in tmpfs, and then do kernel build.
for example, there is 3G memory and then tmpfs size is 6G and there is 6
kernel copy.
> Very unfortunately, this patch isn't acceptable. In past time, vmscan
> had similar logic, but 1% swap-out made lots bug reports.
can you elaborate this?
Completely restore previous behavior (do full scan with priority 0) is
ok too.

[-- Attachment #2: meminfo --]
[-- Type: text/plain, Size: 1114 bytes --]

MemTotal: 3078372 kB
MemFree: 34612 kB
Buffers: 960 kB
Cached: 2577644 kB
SwapCached: 24580 kB
Active: 2125712 kB
Inactive: 541972 kB
Active(anon): 2120276 kB
Inactive(anon): 534696 kB
Active(file): 5436 kB
Inactive(file): 7276 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 6297472 kB
SwapFree: 6184988 kB
Dirty: 1720 kB
Writeback: 24024 kB
AnonPages: 64888 kB
Mapped: 3996 kB
Shmem: 2566004 kB
Slab: 290416 kB
SReclaimable: 113840 kB
SUnreclaim: 176576 kB
KernelStack: 3072 kB
PageTables: 6832 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 7836656 kB
Committed_AS: 2811564 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 289724 kB
VmallocChunk: 34359444080 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 10240 kB
DirectMap2M: 3127296 kB