archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <>
To: <>
Cc: SeongJae Park <>, <>,
	<>, <>,
	<>, <>,
	<>, <>,
	<>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>, <>,
	<>, <>,
	<>, <>,
	<>, <>
Subject: [RFC v9 0/8] Implement Data Access Monitoring-based Memory Operation Schemes
Date: Tue, 26 May 2020 09:56:54 +0200	[thread overview]
Message-ID: <> (raw)

From: SeongJae Park <>

DAMON[1] can be used as a primitive for data access awared 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.  With this change, users can do the data access aware
optimizations by simply specifying their schemes to DAMON.



We evaluated DAMON's overhead, monitoring quality and usefulness using 25
realistic workloads on my QEMU/KVM based virtual machine.

DAMON is lightweight.  It increases system memory usage by only -0.39% and
consumes less than 1% CPU time in most case.  It slows target workloads down by
only 0.63%.

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

NOTE that the experimentail THP optimization and proactive reclamation are not
for production, just only for proof of concepts.

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


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.6 plus v11 DAMON patchset[1] and Minchan's
``do_madvise()`` patch[2].  Minchan's patch was necessary for reuse of
``madvise()`` code in DAMON.  You can also clone the complete git tree:

    $ git clone git:// -b damos/rfc/v9

The web is also available:

There are a couple of trees for entire DAMON patchset series.  It includes
future features.  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 first patch allows DAMON to reuse ``madvise()`` code for the actions.  The
second patch accounts age of each region.  The third patch implements the
handling of the schemes in DAMON and exports a kernel space programming
interface for it.  The fourth patch implements a debugfs interface for the
privileged people and programs.  The fifth patch implements schemes statistics
feature for easier tuning of the schemes and runtime access pattern analysis.
The sixth patche adds selftests for these changes, and the seventhe patch adds
human friendly schemes support to the user space tool for DAMON.  Finally, the
eighth patch documents this new feature in the document.

Patch History

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

Changes from RFC v7
 - Rebase on DAMON v11 patchset
 - Add documentation

Changes from RFC v6
 - Rebase on DAMON v9 patchset
 - Cleanup code and fix typos (Stefan Nuernberger)

Changes from RFC v5
 - Rebase on DAMON v8 patchset
 - Update test results
 - Fix DAMON userspace tool crash on signal handling
 - Fix checkpatch warnings

Changes from RFC v4
 - Clean up code (Jonathan Cameron)
 - Update test results
 - Rebase on v5.6 + DAMON v7

Changes from RFC v3
 - Add Reviewed-by from Brendan Higgins
 - Code cleanup: Modularize madvise() call
 - Fix a trivial bug in the wrapper python script
 - Add more stable and detailed evaluation results with updated ETHP scheme

Changes from RFC v2
 - Fix aging mechanism for more better 'old region' selection
 - Add more kunittests and kselftests for this patchset
 - Support more human friedly description and application of 'schemes'

Changes from RFC v1
 - Properly adjust age accounting related properties after splitting, merging,
   and action applying

SeongJae Park (8):
  mm/madvise: Export do_madvise() to external GPL modules
  mm/damon: Account age of target regions
  mm/damon: Implement data access monitoring-based operation schemes
  mm/damon/schemes: Implement a debugfs interface
  mm/damon/schemes: Implement statistics feature
  mm/damon/selftests: Add 'schemes' debugfs tests
  damon/tools: Support more human friendly 'schemes' control
  Documentation/admin-guide/mm: Document DAMON-based operation schemes

 Documentation/admin-guide/mm/damon/guide.rst  |  35 ++
 Documentation/admin-guide/mm/damon/usage.rst  | 126 +++++-
 include/linux/damon.h                         |  65 ++++
 mm/damon.c                                    | 361 +++++++++++++++++-
 mm/madvise.c                                  |   1 +
 tools/damon/                 | 128 +++++++
 tools/damon/                         | 143 +++++++
 tools/damon/damo                              |   7 +
 tools/damon/                         | 135 +------
 tools/damon/                        | 105 +++++
 .../testing/selftests/damon/  |  29 ++
 11 files changed, 992 insertions(+), 143 deletions(-)
 create mode 100755 tools/damon/
 create mode 100644 tools/damon/
 create mode 100644 tools/damon/


             reply	other threads:[~2020-05-26  7:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  7:56 SeongJae Park [this message]
2020-05-26  7:56 ` [RFC v9 1/8] mm/madvise: Export do_madvise() to external GPL modules SeongJae Park
2020-05-26  7:56 ` [RFC v9 2/8] mm/damon: Account age of target regions SeongJae Park
2020-05-26  7:56 ` [RFC v9 3/8] mm/damon: Implement data access monitoring-based operation schemes SeongJae Park
2020-05-26  7:56 ` [RFC v9 4/8] mm/damon/schemes: Implement a debugfs interface SeongJae Park
2020-06-04 11:17   ` SeongJae Park
2020-05-26  7:56 ` [RFC v9 5/8] mm/damon/schemes: Implement statistics feature SeongJae Park
2020-05-26  7:57 ` [RFC v9 6/8] mm/damon/selftests: Add 'schemes' debugfs tests SeongJae Park
2020-05-26  8:08 ` [RFC v9 7/8] damon/tools: Support more human friendly 'schemes' control SeongJae Park
2020-05-26  8:08 ` [RFC v9 8/8] Documentation/admin-guide/mm: 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).