linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sjpark@amazon.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: SeongJae Park <sjpark@amazon.com>,
	SeongJae Park <sjpark@amazon.de>, <Jonathan.Cameron@huawei.com>,
	Andrea Arcangeli <aarcange@redhat.com>, <acme@kernel.org>,
	<alexander.shishkin@linux.intel.com>, <amit@kernel.org>,
	<benh@kernel.crashing.org>, <brendan.d.gregg@gmail.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	Qian Cai <cai@lca.pw>, Colin Ian King <colin.king@canonical.com>,
	Jonathan Corbet <corbet@lwn.net>,
	"David Hildenbrand" <david@redhat.com>, <dwmw@amazon.com>,
	"Du, Fan" <fan.du@intel.com>, <foersleo@amazon.de>,
	Greg Thelen <gthelen@google.com>, Ian Rogers <irogers@google.com>,
	<jolsa@redhat.com>, "Kirill A. Shutemov" <kirill@shutemov.name>,
	<mark.rutland@arm.com>, Mel Gorman <mgorman@suse.de>,
	Minchan Kim <minchan@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	<namhyung@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Rik van Riel <riel@surriel.com>,
	David Rientjes <rientjes@google.com>,
	Steven Rostedt <rostedt@goodmis.org>, <rppt@kernel.org>,
	<sblbir@amazon.com>, <shuah@kernel.org>, <sj38.park@gmail.com>,
	<snu@amazon.de>, Vlastimil Babka <vbabka@suse.cz>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Huang Ying <ying.huang@intel.com>, <zgf574564920@gmail.com>,
	<linux-damon@amazon.com>, Linux MM <linux-mm@kvack.org>,
	<linux-doc@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC v7 00/10] DAMON: Support Physical Memory Address Space Monitoring
Date: Thu, 20 Aug 2020 09:10:52 +0200	[thread overview]
Message-ID: <20200820071052.24271-1-sjpark@amazon.com> (raw)
In-Reply-To: <CALvZod6RS66aSFjWHvpbjuinz2mwbGDnz+gh5L7dp+c3D_Zy1w@mail.gmail.com>

On Wed, 19 Aug 2020 18:21:44 -0700 Shakeel Butt <shakeelb@google.com> wrote:

> On Tue, Aug 18, 2020 at 12:25 AM SeongJae Park <sjpark@amazon.com> wrote:
> >
> > From: SeongJae Park <sjpark@amazon.de>
> >
> > Changes from Previous Version
> > =============================
> >
> > - Use 42 as the fake target id for paddr instead of -1
> > - Fix a typo
> >
> > Introduction
> > ============
> >
> > DAMON[1] programming interface users can extend DAMON for any address space by
> > configuring the address-space specific low level primitives with appropriate
> > ones including their own implementations.  However, because the implementation
> > for the virtual address space is only available now, the users should implement
> > their own for other address spaces.  Worse yet, the user space users who rely
> > on the debugfs interface and user space tool, cannot implement their own.
> >
> > This patchset implements another reference implementation of the low level
> > primitives for the physical memory address space.  With this change, hence, the
> > kernel space users can monitor both the virtual and the physical address spaces
> > by simply changing the configuration in the runtime.  Further, this patchset
> > links the implementation to the debugfs interface and the user space tool for
> > the user space users.
> >
> > Note that the implementation supports only the user memory, as same to the idle
> > page access tracking feature.
> >
> > [1] https://lore.kernel.org/linux-mm/20200706115322.29598-1-sjpark@amazon.com/
> >
> 
> I am still struggling to find the benefit of this feature the way it
> is implemented i.e. region based physical address space monitoring.
> What exactly am I supposed to do for a given hot (or cold) physical
> region? In a containerized world, that region can contain pages from
> any cgroup. I can not really do anything about the accesses PHY-DAMON
> provides me for a region.

Technically speaking, this patchset introduces an implementation of DAMON's low
level primitives for physical address space of LRU-listed pages.  In other
words, it is not designed for cgroups case.  Also, please note that this
patchset is only RFC, because it aims to only show the future plan of DAMON and
get opinions about the concept before being serious.  It will be serious only
after the DAMON patchset is merged.  Maybe I didn' made this point clear in the
CV, sorry.  I will state this clearly in the next spin.

However, owing to the flexible design of DAMON, you can still use DAMON for
cgroups case, though you need to make some efforts.  There could be a number of
ways.

First, you could figure out the physical address regions for the target
cgroups by yourself, set the target regions by yourself in 'damon_ctx' object
and pass it to 'damon_start()'.  For dynamic page allocations, you could check
if a monitored region belongs to your target cgroup or not from your action
making code, which could be implemented in the '->sample_cb()' or
'->aggregate_cb()' callbacks.

Note that you can even update the regions inside the callbacks.  That is, you
can remove regions containing pages of other containers, add new pages
allocated for your target containers, adjust regions having pages of both other
container and your target containers to represent only your target container's.

Second, you could expand DAMON for cgroups by implementing your own low level
primitives.  You could also reuse some of the current implementation.  For
example, you could implement only '->init_target_regions' and
'->update_target_regions' callbacks again so that only the pages of your target
cgroup belongs in the target regions.  However, if you need to monitor
non-LRU-listed pages, you should implement '->prepare_access_checks()' and
'->check_accesses()' callbacks.

> 
> Now if you give me per-page information that would be useful as I can
> at least get per-cgroup accesses (idle or re-use data) but that would
> be as costly as Page Idle Tracking.

So, seems you are saying about the 'adaptive regions adjustment' disabled page
granularity monitoring case.

Indeed.  Same information comes with same overhead.  Moreover, in the page
granularity monitoring case, DAMON will make more space overhead (at least 8
bytes per page), because DAMON will represent each page as a physical address
region having start address and end address, while Idle Pages Tracking can use
only pfn.  I'm planning optimizations for this page granularity case as a
future work.

However, if you don't strictly need page granularity accuracy, you could reduce
the overhead by using larger granularity.  That is, you can set the monitoring
granularity as you want while the adaptive regions adjustment is disabled.  You
could even use variable granularity in this case using the callbacks mentioned
above.


So, DAMON is a framework rather than a tool.  Though it comes with basic
applications using DAMON as a framework (e.g., the virtual address space low
primitives implementation, DAMON debugfs interface, and the DAMON user space
tool) that could be useful in simple use cases, you need to code your
application on it if your use cases are out of the simple cases.  I will also
develop more of such applications for more use-cases, but it will be only after
the framework is complete enough to be merged in the mainline.


Thanks,
SeongJae Park


  reply	other threads:[~2020-08-20  7:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  7:24 [RFC v7 00/10] DAMON: Support Physical Memory Address Space Monitoring SeongJae Park
2020-08-18  7:24 ` [RFC v7 01/10] mm/damon/debugfs: Allow users to set initial monitoring target regions SeongJae Park
2020-08-18  7:24 ` [RFC v7 02/10] tools/damon: Support init target regions specification SeongJae Park
2020-08-18  7:24 ` [RFC v7 03/10] mm/damon-test: Add more unit tests for 'init_regions' SeongJae Park
2020-08-18 19:22   ` Brendan Higgins
2020-08-18  7:24 ` [RFC v7 04/10] selftests/damon/_chk_record: Do not check number of gaps SeongJae Park
2020-08-18  7:24 ` [RFC v7 05/10] Docs/admin-guide/mm/damon: Document 'init_regions' feature SeongJae Park
2020-08-18  7:24 ` [RFC v7 06/10] mm/damon: Implement callbacks for physical memory monitoring SeongJae Park
2020-08-20  0:26   ` Shakeel Butt
2020-08-20  7:16     ` SeongJae Park
2020-08-20 13:26       ` Shakeel Butt
2020-08-20 14:28         ` SeongJae Park
2020-08-28  8:11   ` Alkaid
2020-08-28  9:53     ` SeongJae Park
2020-08-28 11:39       ` SeongJae Park
2020-08-18  7:24 ` [RFC v7 07/10] mm/damon/debugfs: Support " SeongJae Park
2020-08-18  7:24 ` [RFC v7 08/10] tools/damon/record: " SeongJae Park
2020-08-18  7:25 ` [RFC v7 09/10] tools/damon/record: Support NUMA specific recording SeongJae Park
2020-08-18  7:25 ` [RFC v7 10/10] Docs/DAMON: Document physical memory monitoring support SeongJae Park
2020-08-20  1:21 ` [RFC v7 00/10] DAMON: Support Physical Memory Address Space Monitoring Shakeel Butt
2020-08-20  7:10   ` SeongJae Park [this message]
2020-08-20 15:44     ` Shakeel Butt
2020-08-20 17:33       ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20200820071052.24271-1-sjpark@amazon.com \
    --to=sjpark@amazon.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=aarcange@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=amit@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=brendan.d.gregg@gmail.com \
    --cc=brendanhiggins@google.com \
    --cc=cai@lca.pw \
    --cc=colin.king@canonical.com \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=dwmw@amazon.com \
    --cc=fan.du@intel.com \
    --cc=foersleo@amazon.de \
    --cc=gthelen@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=kirill@shutemov.name \
    --cc=linux-damon@amazon.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=riel@surriel.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=sblbir@amazon.com \
    --cc=shakeelb@google.com \
    --cc=shuah@kernel.org \
    --cc=sj38.park@gmail.com \
    --cc=sjpark@amazon.de \
    --cc=snu@amazon.de \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=zgf574564920@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).