archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <>
To: <>
Cc: SeongJae Park <>, <>,
	<>, <>,
	<>, <>,
	<>, <>,
	<>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>,
	<>, <>,
	<>, <>,
	<>, <>
Subject: [RFC v15.1 0/8] Implement Data Access Monitoring-based Memory Operation Schemes
Date: Wed, 16 Dec 2020 09:43:56 +0100	[thread overview]
Message-ID: <> (raw)

From: SeongJae Park <>

NOTE: This is only an RFC for future features of DAMON patchset[1], which is
not merged in the mainline yet.  The aim of this RFC is to show how DAMON would
be evolved once it is merged in.  So, if you have some interest in this RFC,
please consider reviewing the DAMON patchset, either.

Changes from Previous Version

Only below minor changes made on v15 of this patchset.  Therefore I'm setting
the version number to v15.1 rather than v16.

- Rebase on v5.10 + DAMON v23[1]
- Drop the dependency on Minchan's out-of-tree patch (It's merged in v5.10)


DAMON[1] can be used as a primitive for data access aware memory management
optimizations.  For that, users who want such optimizations should run DAMON,
read the monitoring results, analyze it, plan a new memory management scheme,
and apply the new scheme by themselves.  Such efforts will be inevitable for
some complicated optimizations.

However, in many other cases, the users would simply want the system to apply a
memory management action to a memory region of a specific size having a
specific access frequency for a specific time.  For example, "page out a memory
region larger than 100 MiB keeping only rare accesses more than 2 minutes", or
"Do not use THP for a memory region larger than 2 MiB rarely accessed for more
than 1 seconds".

This RFC patchset makes DAMON to handle such data access monitoring-based
Operation Schemes (DAMOS).  With this change, users can do the data access
aware optimizations by simply specifying their schemes.



We evaluated DAMON's overhead, monitoring quality and usefulness using 24
realistic workloads on my QEMU/KVM based virtual machine running a kernel that
v23 DAMON patchset is applied.

DAMON is lightweight.  It increases system memory usage by 0.42% and slows
target workloads down by 0.39%.

DAMON is accurate and useful for memory management optimizations.  An
experimental DAMON-based operation scheme for THP, 'ethp', removes 81.45% of
THP memory overheads while preserving 50.09% of THP speedup.  Another
experimental DAMON-based 'proactive reclamation' implementation, 'prcl',
reduces 91.45% of residential sets and 22.91% of system memory footprint while
incurring only 2.43% runtime overhead in the best case (parsec3/freqmine).

NOTE that the experimental THP optimization and proactive reclamation are not
for production but only for proof of concepts.

Please refer to the official document[1] or "Documentation/admin-guide/mm: Add
a document for DAMON" patch in this patchset for detailed evaluation setup and


More Information

We prepared a showcase web site[1] that you can get more information.  There

- the official documentations[2],
- the heatmap format dynamic access pattern of various realistic workloads for
  heap area[3], mmap()-ed area[4], and stack[5] area,
- the dynamic working set size distribution[6] and chronological working set
  size changes[7], and
- the latest performance test results[8].


Baseline and Complete Git Tree

The patches are based on the v5.10 plus v23 DAMON patchset[1].  You can also
clone the complete git tree:

    $ git clone git:// -b damos/rfc/v15.1

The web is also available:

There are a couple of trees for entire DAMON patchset series that future
features are included.  The first one[3] contains the changes for latest
release, while the other one[4] contains the changes for next release.


Sequence Of Patches

The 1st patch accounts age of each region.  The 2nd patch implements the
core of the DAMON-based operation schemes feature.  The 3rd patch makes
the default monitoring primitives for virtual address spaces to support the
schemes.  From this point, the kernel space users can use DAMOS.  The 4th patch
exports the feature to the user space via the debugfs interface.  The 5th patch
implements schemes statistics feature for easier tuning of the schemes and
runtime access pattern analysis.  The 6th patch adds selftests for these
changes, and the 7th patch adds human friendly schemes support to the user
space tool for DAMON.  Finally, the 8th patch documents this new feature.

Patch History

Changes from RFC v15
- Rebase on v5.10 + DAMON v23[1]
- Drop the dependency on Minchan's out-of-tree patch (It's merged in v5.10)

Changes from RFC v14
- s/snprintf()/scnprintf() (Marco Elver)
- Place three parts of DAMON (core, primitives, and dbgfs) in different files

Changes from RFC v13
- Drop loadable module support
- Use dedicated valid action checker function
- Rebase on v5.8 plus v19 DAMON

Changes from RFC v12
 - Wordsmith the document, comment, commit messages
 - Support a scheme of max access count 0
 - Use 'unsigned long' for (min|max)_sz_region

Changes from RFC v11
 - Refine the commit messages (David Hildenbrand)
 - Clean up debugfs code

Changes from RFC v10
 - Fix the wrong error handling for schemes debugfs file
 - Handle the schemes stats from the user space tool
 - Remove the schemes implementation plan from the document

Changes from RFC v9
 - Rebase on v5.7
 - Fix wrong comments and documents for schemes apply conditions

Changes from RFC v8
 - Rewrite the document (Stefan Nuernberger)
 - Make 'damon_for_each_*' argument order consistent (Leonard Foerster)
 - Implement statistics for schemes
 - Avoid races between debugfs readers and writers
 - Reset age for only significant access frequency changes
 - Add kernel-doc comments in damon.h

Please refer to RFC v8 for previous history

SeongJae Park (8):
  mm/damon/core: Account age of target regions
  mm/damon/core: Implement DAMON-based Operation Schemes (DAMOS)
  mm/damon/vaddr: Support DAMON-based Operation Schemes
  mm/damon/dbgfs: Support DAMON-based Operation Schemes
  mm/damon/schemes: Implement statistics feature
  selftests/damon: Add 'schemes' debugfs tests
  tools/damon: Support more human friendly 'schemes' control
  Docs/admin-guide/mm/damon: Document DAMON-based Operation Schemes

 Documentation/admin-guide/mm/damon/guide.rst  |  41 ++++-
 Documentation/admin-guide/mm/damon/start.rst  |  11 ++
 Documentation/admin-guide/mm/damon/usage.rst  | 109 ++++++++++-
 Documentation/vm/damon/index.rst              |   1 -
 include/linux/damon.h                         |  92 +++++++++-
 mm/damon/core.c                               | 125 +++++++++++++
 mm/damon/dbgfs.c                              | 170 +++++++++++++++++-
 mm/damon/vaddr.c                              |  58 ++++++
 tools/damon/                 | 141 +++++++++++++++
 tools/damon/                         |  28 ++-
 tools/damon/damo                              |   7 +
 tools/damon/                        | 110 ++++++++++++
 .../testing/selftests/damon/  |  29 +++
 13 files changed, 903 insertions(+), 19 deletions(-)
 create mode 100755 tools/damon/
 create mode 100644 tools/damon/


             reply	other threads:[~2020-12-16  8:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16  8:43 SeongJae Park [this message]
2020-12-16  8:43 ` [RFC v15.1 1/8] mm/damon/core: Account age of target regions SeongJae Park
2020-12-16  8:43 ` [RFC v15.1 2/8] mm/damon/core: Implement DAMON-based Operation Schemes (DAMOS) SeongJae Park
2020-12-16  8:43 ` [RFC v15.1 3/8] mm/damon/vaddr: Support DAMON-based Operation Schemes SeongJae Park
2020-12-16  8:44 ` [RFC v15.1 4/8] mm/damon/dbgfs: " SeongJae Park
2020-12-16  8:44 ` [RFC v15.1 5/8] mm/damon/schemes: Implement statistics feature SeongJae Park
2020-12-16  8:44 ` [RFC v15.1 6/8] selftests/damon: Add 'schemes' debugfs tests SeongJae Park
2020-12-16  8:44 ` [RFC v15.1 7/8] tools/damon: Support more human friendly 'schemes' control SeongJae Park
2020-12-16  8:44 ` [RFC v15.1 8/8] Docs/admin-guide/mm/damon: Document DAMON-based Operation Schemes SeongJae Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).