Skip to content

RFC Prevent kswapd dumping excessive amounts of memory in response to high-order allocations

Mel Gorman linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mm: kswapd: Stop high-order balancing when any suitable zone is balancedinclude/linux/mmzone.h mm/page_alloc.c mm/vmscan.c+42 -1110 replies
2/3mm: kswapd: Use the order that kswapd was reclaiming at for sleeping_prematurely()mm/vmscan.c+24 -60 replies
3/3mm: kswapd: Keep kswapd awake for high-order allocations until a percentage of the node is balancedmm/vmscan.c+22 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] Prevent kswapd dumping excessive amounts of memory in response to high-order allocations

Simon Kirby reported the following problem

We're seeing cases on a number of servers where cache never fully grows to use all available memory. Sometimes we see servers with 4 GB of memory that never seem to have less than 1.5 GB free, even with a constantly-active VM. In some cases, these servers also swap out while this happens, even though they are constantly reading the working set into memory. We have been seeing this happening for a long time; I don't think it's anything recent, and it still happens on 2.6.36.

After some debugging work by Simon, Dave Hansen and others, the prevaling theory became that kswapd is reclaiming order-3 pages requested by SLUB too aggressive about it.

There are two apparent problems here. On the target machine, there is a small Normal zone in comparison to DMA32. As kswapd tries to balance all zones, it would continually try reclaiming for Normal even though DMA32 was balanced enough for callers. The second problem is that sleeping_prematurely() uses the requested order, not the order kswapd finally reclaimed at. This keeps kswapd artifically awake.

This series aims to alleviate these problems but needs testing to confirm it alleviates the actual problem and wider review to think if there is a better alternative approach. Local tests passed but are not reproducing the same problem unfortunately so the results are inclusive.

 include/linux/mmzone.h |    3 +-
 mm/page_alloc.c        |    2 +-
 mm/vmscan.c            |   90 ++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 79 insertions(+), 16 deletions(-)