Skip to content

RFC NUMA balancing: optimize memory placement for memory tiering system

Huang Ying linux-mm lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 0 repliesNew

v7 from the cover letter

- Rebased on the mmots tree of 2021-07-15.

- Some minor fixes.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6NUMA balancing: optimize page placement for memory tiering systeminclude/linux/sched/sysctl.h kernel/sched/core.c kernel/sysctl.c +2 more+51 -120 replies
2/6memory tiering: add page promotion counterinclude/linux/mmzone.h include/linux/node.h mm/migrate.c +1 more+20 -20 replies
3/6memory tiering: skip to scan fast memorymm/huge_memory.c mm/mprotect.c+33 -100 replies
4/6memory tiering: hot page selection with hint page fault latencyinclude/linux/mm.h include/linux/sched/sysctl.h kernel/sched/fair.c +6 more+160 -50 replies
5/6memory tiering: rate limit NUMA migration throughputinclude/linux/mmzone.h include/linux/sched/sysctl.h kernel/sched/fair.c +2 more+42 -20 replies
6/6memory tiering: adjust hot threshold automaticallyinclude/linux/mmzone.h kernel/sched/fair.c+39 -40 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC -V7 0/6] NUMA balancing: optimize memory placement for memory tiering system

This patchset is based on mmots tree of 2021-07-15.

Especially, it depends on the following patchset in mmots tree,

[PATCH -V10 0/9] Migrate Pages in lieu of discard
https://lore.kernel.org/lkml/[email protected]/

This is part of a larger patch set. If you want to apply these or play with them, I'd suggest using the tree from below,

https://github.com/hying-caritas/linux/commits/mt-20210722

The changes since the last post are as follows,

- Rebased on the mmots tree of 2021-07-15.

- Some minor fixes.

--

With the advent of various new memory types, some machines will have multiple types of memory, e.g. DRAM and PMEM (persistent memory). The memory subsystem of these machines can be called memory tiering system, because the performance of the different types of memory are usually different.

After commit c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM"), the PMEM could be used as the cost-effective volatile memory in separate NUMA nodes. In a typical memory tiering system, there are CPUs, DRAM and PMEM in each physical NUMA node. The CPUs and the DRAM will be put in one logical node, while the PMEM will be put in another (faked) logical node.

To optimize the system overall performance, the hot pages should be placed in DRAM node. To do that, we need to identify the hot pages in the PMEM node and migrate them to DRAM node via NUMA migration.

In the original NUMA balancing, there are already a set of existing mechanisms to identify the pages recently accessed by the CPUs in a node and migrate the pages to the node. So we can reuse these mechanisms to build the mechanisms to optimize the page placement in the memory tiering system. This has been implemented in this patchset.

At the other hand, the cold pages should be placed in PMEM node. So, we also need to identify the cold pages in the DRAM node and migrate them to PMEM node.

In the following patchset (now in the latest mmots tree),

[PATCH -V10 0/9] Migrate Pages in lieu of discard
https://lore.kernel.org/lkml/[email protected]/

A mechanism to demote the cold DRAM pages to PMEM node under memory pressure is implemented. Based on that, the cold DRAM pages can be demoted to PMEM node proactively to free some memory space on DRAM node to accommodate the promoted hot PMEM pages. This has been implemented in this patchset too.

We have tested the solution with the pmbench memory accessing benchmark with the 80:20 read/write ratio and the normal access address distribution on a 2 socket Intel server with Optane DC Persistent Memory Model. The test results of the base kernel and step by step optimizations are as follows,

Throughput Promotion DRAM bandwidth
access/s MB/s MB/s
----------- ---------- --------------
Base 74238178.0 4291.7

Patch 2        146050652.3          359.4             11248.6
Patch 3        146300787.1          355.2             11237.2
Patch 4        162536383.0          211.7             11890.4
Patch 5        157187775.0          105.9             10412.3
Patch 6        164028415.2           73.3             10810.6

The whole patchset improves the benchmark score up to 119.1%. The basic NUMA balancing based optimization solution (patch 1), the hot page selection algorithm (patch 4), and the threshold automatic adjustment algorithms (patch 6) improves the performance or reduce the overhead (promotion MB/s) mostly.

Changelog:

v7:

- Rebased on the mmots tree of 2021-07-15.

- Some minor fixes.

v6:

- Rebased on the latest page demotion patchset. (which bases on v5.11)

v5:

- Rebased on the latest page demotion patchset. (which bases on v5.10)

v4:

- Rebased on the latest page demotion patchset. (which bases on v5.9-rc6)

- Add page promotion counter.

v3:

- Move the rate limit control as late as possible per Mel Gorman's comments.

- Revise the hot page selection implementation to store page scan time in struct page.

- Code cleanup.

- Rebased on the latest page demotion patchset.

v2:

- Addressed comments for V1.

- Rebased on v5.5.

Best Regards,
Huang, Ying