Skip to content

RFC Move LRU page reclaim from zones to nodes

Mel Gorman linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest25 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/25mm, vmstat: Add infrastructure for per-node vmstatsdrivers/base/node.c include/linux/mmzone.h include/linux/vmstat.h +2 more+364 -630 replies
2/25mm, vmscan: Move lru_lock to the nodeinclude/linux/mmzone.h mm/compaction.c mm/filemap.c +7 more+61 -550 replies
3/25mm, vmscan: Move LRU lists to nodearch/tile/mm/pgtable.c drivers/base/node.c drivers/staging/android/lowmemorykiller.c +23 more+354 -3130 replies
4/25mm, vmscan: Begin reclaiming pages on a per-node basismm/vmscan.c+45 -300 replies
5/25mm, vmscan: Have kswapd only scan based on the highest requested zonemm/vmscan.c+2 -50 replies
6/25mm, vmscan: Avoid a second search through zones checking if compaction is requiredmm/vmscan.c+13 -180 replies
7/25mm, vmscan: Make kswapd think of reclaim in terms of nodesmm/vmscan.c+87 -1770 replies
8/25mm, vmscan: By default have direct reclaim only shrink once per nodemm/vmscan.c+12 -120 replies
9/25mm, vmscan: Clear congestion, dirty and need for compaction on a per-node basismm/vmscan.c+24 -300 replies
10/25mm, vmscan: Make shrink_node decisions more node-centricinclude/linux/memcontrol.h include/linux/mmzone.h include/linux/swap.h +3 more+48 -390 replies
11/25mm, workingset: Make working set detection node-awareinclude/linux/mmzone.h mm/vmstat.c mm/workingset.c+27 -320 replies
12/25mm, page_alloc: Consider dirtyable memory in terms of nodesinclude/linux/mmzone.h include/linux/writeback.h mm/page-writeback.c +1 more+62 -490 replies
13/25mm: Move NR_FILE_MAPPED accounting to the nodearch/tile/mm/pgtable.c drivers/base/node.c fs/proc/meminfo.c +5 more+20 -200 replies
14/25mm: Rename NR_ANON_PAGES to NR_ANON_MAPPEDfs/proc/meminfo.c include/linux/mmzone.h mm/migrate.c +1 more+7 -70 replies
15/25mm: Move most file-based accounting to the nodearch/s390/appldata/appldata_mem.c arch/tile/mm/pgtable.c drivers/base/node.c +19 more+106 -1140 replies
16/25mm, vmscan: Update classzone_idx if buffer_heads_over_limitmm/vmscan.c+3 -10 replies
17/25mm, vmscan: Check if cpusets are enabled during direct reclaimmm/vmscan.c+1 -10 replies
18/25mm, vmscan: Only wakeup kswapd once per node for the requested classzonemm/vmscan.c+9 -20 replies
19/25mm, vmscan: Account in vmstat for pages skipped during reclaiminclude/linux/vm_event_item.h mm/vmscan.c mm/vmstat.c+8 -10 replies
20/25mm, page_alloc: Remove fair zone allocation policyinclude/linux/mmzone.h mm/internal.h mm/page_alloc.c +1 more+1 -720 replies
21/25mm, page_alloc: Defer zlc_setup until it is known it is requiredmm/page_alloc.c+4 -40 replies
22/25mm: Convert zone_reclaim to node_reclaiminclude/linux/mmzone.h include/linux/swap.h include/linux/topology.h +5 more+85 -720 replies
23/25mm, page_alloc: Delete the zonelist_cacheinclude/linux/mmzone.h mm/page_alloc.c mm/vmstat.c+8 -2880 replies
24/25mm, page_alloc: Use ac->classzone_idx instead of zone_idx(preferred_zone)mm/page_alloc.c+1 -10 replies
25/25mm: page_alloc: Take fewer passes when allocating to the low watermarkmm/page_alloc.c+21 -00 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 00/25] Move LRU page reclaim from zones to nodes

This is an RFC series against 4.0 that moves LRUs from the zones to the node. In concept, this is straight forward but there are a lot of details so I'm posting it early to see what people think. The motivations are;

1. Currently, reclaim on node 0 behaves differently to node 1 with subtly different aging rules. Workloads may exhibit different behaviour depending on what node it was scheduled on as a result.

2. The residency of a page partially depends on what zone the page was allocated from. This is partially combatted by the fair zone allocation policy but that is a partial solution that introduces overhead in the page allocator paths.

3. kswapd and the page allocator play special games with the order they scan zones to avoid interfering with each other but it's unpredictable.

4. The different scan activity and ordering for zone reclaim is very difficult to predict.

5. slab shrinkers are node-based which makes relating page reclaim to slab reclaim harder than it should be.

The reason we have zone-based reclaim is that we used to have large highmem zones in common configurations and it was necessary to quickly find ZONE_NORMAL pages for reclaim. Today, this is much less of a concern as machines with lots of memory will (or should) use 64-bit kernels. Combinations of 32-bit hardware and 64-bit hardware are rare. Machines that do use highmem should have relatively low highmem:lowmem ratios than we worried about in the past.

Conceptually, moving to node LRUs should be easier to understand. The page allocator plays fewer tricks to game reclaim and reclaim behaves similarly on all nodes.

The series is very long and bisection will be hazardous due to being misleading as infrastructure is reshuffled. The rational bisection points are

[PATCH 01/25] mm, vmstat: Add infrastructure for per-node vmstats [PATCH 19/25] mm, vmscan: Account in vmstat for pages skipped during reclaim [PATCH 21/25] mm, page_alloc: Defer zlc_setup until it is known it is required [PATCH 23/25] mm, page_alloc: Delete the zonelist_cache
[PATCH 25/25] mm: page_alloc: Take fewer passes when allocating to the low watermark

It was tested on a UMA (8 cores single socket) and a NUMA machine (48 cores, 4 sockets). The page allocator tests showed marginal differences in aim9, page fault microbenchmark, page allocator micro-benchmark and ebizzy. This was expected as the affected paths are small in comparison to the overall workloads.

I also tested using fstest on zero-length files to stress slab reclaim. It showed no major differences in performance or stats.

A THP-based test case that stresses compaction was inconclusive. It showed differences in the THP allocation success rate and both gains and losses in the time it takes to allocate THP depending on the number of threads running.

Tests did show there were differences in the pages allocated from each zone. This is due to the fact the fair zone allocation policy is removed as with node-based LRU reclaim, it *should* not be necessary. It would be preferable if the original database workload that motivated the introduction of that policy was retested with this series though.

The raw figures as such are not that interesting -- things perform more or less the same which is what you'd hope.

 arch/s390/appldata/appldata_mem.c         |   2 +-
 arch/tile/mm/pgtable.c                    |  18 +-
 drivers/base/node.c                       |  73 +--
 drivers/staging/android/lowmemorykiller.c |  12 +-
 fs/fs-writeback.c                         |   8 +-
 fs/fuse/file.c                            |   8 +-
 fs/nfs/internal.h                         |   2 +-
 fs/nfs/write.c                            |   2 +-
 fs/proc/meminfo.c                         |  14 +-
 include/linux/backing-dev.h               |   2 +-
 include/linux/memcontrol.h                |  15 +-
 include/linux/mm_inline.h                 |   4 +-
 include/linux/mmzone.h                    | 224 ++++------
 include/linux/swap.h                      |  11 +-
 include/linux/topology.h                  |   2 +-
 include/linux/vm_event_item.h             |  11 +-
 include/linux/vmstat.h                    |  94 +++-
 include/linux/writeback.h                 |   2 +-
 include/trace/events/vmscan.h             |  10 +-
 include/trace/events/writeback.h          |   6 +-
 kernel/power/snapshot.c                   |  10 +-
 kernel/sysctl.c                           |   4 +-
 mm/backing-dev.c                          |  14 +-
 mm/compaction.c                           |  25 +-
 mm/filemap.c                              |  16 +-
 mm/huge_memory.c                          |  14 +-
 mm/internal.h                             |  11 +-
 mm/memcontrol.c                           |  37 +-
 mm/memory-failure.c                       |   4 +-
 mm/memory_hotplug.c                       |   2 +-
 mm/mempolicy.c                            |   2 +-
 mm/migrate.c                              |  31 +-
 mm/mlock.c                                |  12 +-
 mm/mmap.c                                 |   4 +-
 mm/nommu.c                                |   4 +-
 mm/page-writeback.c                       | 109 ++---
 mm/page_alloc.c                           | 489 ++++++--------------
 mm/rmap.c                                 |  16 +-
 mm/shmem.c                                |  12 +-
 mm/swap.c                                 |  66 +--
 mm/swap_state.c                           |   4 +-
 mm/truncate.c                             |   2 +-
 mm/vmscan.c                               | 718 ++++++++++++++----------------
 mm/vmstat.c                               | 308 ++++++++++---
 mm/workingset.c                           |  49 +-
 45 files changed, 1225 insertions(+), 1258 deletions(-)
Signature · 7 lines
2.3.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>