linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] mm: demotion: Introduce new node state N_DEMOTION_TARGETS
@ 2022-04-22 19:55 Jagdish Gediya
  2022-04-22 19:55 ` [PATCH v3 1/7] mm: demotion: Fix demotion targets sharing among sources Jagdish Gediya
                   ` (7 more replies)
  0 siblings, 8 replies; 35+ messages in thread
From: Jagdish Gediya @ 2022-04-22 19:55 UTC (permalink / raw)
  To: linux-mm, linux-kernel, akpm
  Cc: baolin.wang, dave.hansen, ying.huang, aneesh.kumar, shy828301,
	weixugc, gthelen, dan.j.williams, Jagdish Gediya

Some systems(e.g. PowerVM) can have both DRAM(fast memory) only
NUMA node which are N_MEMORY and slow memory(persistent memory)
only NUMA node which are also N_MEMORY. As the current demotion
target finding algorithm works based on N_MEMORY and best distance,
it will choose DRAM only NUMA node as demotion target instead of
persistent memory node on such systems. If DRAM only NUMA node is
filled with demoted pages then at some point new allocations can
start falling to persistent memory, so basically cold pages are in
fast memor (due to demotion) and new pages are in slow memory, this
is why persistent memory nodes should be utilized for demotion and
dram node should be avoided for demotion so that they can be used
for new allocations.

Current implementation can work fine on the system where the memory
only numa nodes are possible only for persistent/slow memory but it
is not suitable for the like of systems mentioned above.

This patch series introduces the new node state N_DEMOTION_TARGETS,
which is used to distinguish the nodes which can be used as demotion
targets, node_states[N_DEMOTION_TARGETS] is used to hold the list of
nodes which can be used as demotion targets.

node state N_DEMOTION_TARGETS is also set from the dax kmem driver,
certain type of memory which registers through dax kmem (e.g. HBM)
may not be the right choices for demotion so in future they should
be distinguished based on certain attributes and dax kmem driver
should avoid setting them as N_DEMOTION_TARGETS, however current
implementation also doesn't distinguish any  such memory and it
considers all N_MEMORY as demotion targets so this patch series
doesn't modify the current behavior.

below command can be used to view the available demotion targets in
the system,

$ cat /sys/devices/system/node/demotion_targets

This patch series sets N_DEMOTION_TARGET from dax device kmem driver,
It may be possible that some memory node desired as demotion target
is not detected in the system from dax-device kmem probe path. It is
also possible that some of the dax-devices are not preferred as
demotion target e.g. HBM, for such devices, node shouldn't be set to
N_DEMOTION_TARGETS, so support is also added to set the demotion
target list from user space so that default behavior can be overridden
to avoid or add specific node to demotion targets manually.

Override the demotion targets in the system (which sets the
node_states[N_DEMOTION_TARGETS] in kernel),
$ echo <node list> > /sys/devices/system/node/demotion_targets

As by default node attributes under /sys/devices/system/node/ are read-
only, support is added to write node_states[] via sysfs so that
node_states[N_DEMOTION_TARGETS] can be modified from user space via
sysfs.

It is also helpful to know per node demotion target path prepared by
kernel to understand the demotion behaviour during reclaim, so this
patch series also adds a /sys/devices/system/node/nodeX/demotion_targets
interface to view per-node demotion targets via sysfs.

Current code which sets migration targets is modified in
this patch series to avoid some of the limitations on the demotion
target sharing and to use N_DEMOTION_TARGETS only nodes while
finding demotion targets.

Changelog
----------

v2:
In v1, only 1st patch of this patch series was sent, which was
implemented to avoid some of the limitations on the demotion
target sharing, however for certain numa topology, the demotion
targets found by that patch was not most optimal, so 1st patch
in this series is modified according to suggestions from Huang
and Baolin. Different examples of demotion list comparasion
between existing implementation and changed implementation can
be found in the commit message of 1st patch.

v3:
- Modify patch 1 subject to make it more specific
- Remove /sys/kernel/mm/numa/demotion_targets interface, use
  /sys/devices/system/node/demotion_targets instead and make
  it writable to override node_states[N_DEMOTION_TARGETS].
- Add support to view per node demotion targets via sysfs

Jagdish Gediya (8):
  mm: demotion: Fix demotion targets sharing among sources
  mm: demotion: Add new node state N_DEMOTION_TARGETS
  drivers/base/node: Add support to write node_states[] via sysfs
  device-dax/kmem: Set node state as N_DEMOTION_TARGETS
  mm: demotion: Build demotion list based on N_DEMOTION_TARGETS
  mm: demotion: expose per-node demotion targets via sysfs
  docs: numa: Add documentation for demotion

 Documentation/admin-guide/mm/index.rst        |  1 +
 .../admin-guide/mm/numa_demotion.rst          | 57 +++++++++++++++
 drivers/base/node.c                           | 70 ++++++++++++++++---
 drivers/dax/kmem.c                            |  2 +
 include/linux/migrate.h                       |  1 +
 include/linux/nodemask.h                      |  1 +
 mm/migrate.c                                  | 54 ++++++++++----
 7 files changed, 162 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/admin-guide/mm/numa_demotion.rst

-- 
2.35.1



^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2022-04-27  3:34 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 19:55 [PATCH v3 0/7] mm: demotion: Introduce new node state N_DEMOTION_TARGETS Jagdish Gediya
2022-04-22 19:55 ` [PATCH v3 1/7] mm: demotion: Fix demotion targets sharing among sources Jagdish Gediya
2022-04-24  3:25   ` ying.huang
2022-04-25  9:32     ` Jagdish Gediya
2022-04-26  7:26       ` ying.huang
2022-04-22 19:55 ` [PATCH v3 2/7] mm: demotion: Add new node state N_DEMOTION_TARGETS Jagdish Gediya
2022-04-22 20:29   ` Wei Xu
2022-04-22 19:55 ` [PATCH v3 3/7] drivers/base/node: Add support to write node_states[] via sysfs Jagdish Gediya
2022-04-22 20:32   ` Wei Xu
2022-04-24  6:25   ` Aneesh Kumar K.V
2022-04-25  9:42     ` Jagdish Gediya
2022-04-24  6:29   ` ying.huang
2022-04-22 19:55 ` [PATCH v3 4/7] device-dax/kmem: Set node state as N_DEMOTION_TARGETS Jagdish Gediya
2022-04-22 20:34   ` Wei Xu
2022-04-22 19:55 ` [PATCH v3 5/7] mm: demotion: Build demotion list based on N_DEMOTION_TARGETS Jagdish Gediya
2022-04-22 20:39   ` Wei Xu
2022-04-22 19:55 ` [PATCH v3 6/7] mm: demotion: expose per-node demotion targets via sysfs Jagdish Gediya
2022-04-22 20:47   ` Wei Xu
2022-04-23  7:30   ` kernel test robot
2022-04-23  8:38   ` kernel test robot
2022-04-22 19:55 ` [PATCH v3 7/7] docs: numa: Add documentation for demotion Jagdish Gediya
2022-04-24  3:19 ` [PATCH v3 0/7] mm: demotion: Introduce new node state N_DEMOTION_TARGETS ying.huang
2022-04-25 11:15   ` Jagdish Gediya
2022-04-25 13:57     ` Jonathan Cameron
2022-04-25 14:44       ` Aneesh Kumar K V
2022-04-26 10:43         ` Jonathan Cameron
2022-04-27  1:29         ` ying.huang
2022-04-27  2:57           ` Aneesh Kumar K V
2022-04-27  3:34             ` ying.huang
2022-04-25 14:53       ` Aneesh Kumar K V
2022-04-26 10:37         ` Jonathan Cameron
2022-04-26  7:55     ` ying.huang
2022-04-26  9:07       ` Aneesh Kumar K V
2022-04-26  9:10         ` ying.huang
2022-04-26  9:37       ` Jagdish Gediya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).