diff options
author | Christoph Lameter <cl@linux.com> | 2010-09-09 16:38:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-09-09 18:57:25 -0700 |
commit | aa45484031ddee09b06350ab8528bfe5b2c76d1c (patch) | |
tree | 6758072232db9a54453022ec3e6cede35d52001c /drivers/cpuidle | |
parent | 72853e2991a2702ae93aaf889ac7db743a415dd3 (diff) | |
download | linux-aa45484031ddee09b06350ab8528bfe5b2c76d1c.tar.gz linux-aa45484031ddee09b06350ab8528bfe5b2c76d1c.tar.bz2 linux-aa45484031ddee09b06350ab8528bfe5b2c76d1c.zip |
mm: page allocator: calculate a better estimate of NR_FREE_PAGES when memory is low and kswapd is awake
Ordinarily watermark checks are based on the vmstat NR_FREE_PAGES as it is
cheaper than scanning a number of lists. To avoid synchronization
overhead, counter deltas are maintained on a per-cpu basis and drained
both periodically and when the delta is above a threshold. On large CPU
systems, the difference between the estimated and real value of
NR_FREE_PAGES can be very high. If NR_FREE_PAGES is much higher than
number of real free page in buddy, the VM can allocate pages below min
watermark, at worst reducing the real number of pages to zero. Even if
the OOM killer kills some victim for freeing memory, it may not free
memory if the exit path requires a new page resulting in livelock.
This patch introduces a zone_page_state_snapshot() function (courtesy of
Christoph) that takes a slightly more accurate view of an arbitrary vmstat
counter. It is used to read NR_FREE_PAGES while kswapd is awake to avoid
the watermark being accidentally broken. The estimate is not perfect and
may result in cache line bounces but is expected to be lighter than the
IPI calls necessary to continually drain the per-cpu counters while kswapd
is awake.
Signed-off-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/cpuidle')
0 files changed, 0 insertions, 0 deletions