mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: "Lian Wang (ProcessMission)" <lianux.mm@gmail.com>
Cc: SJ Park <sj@kernel.org>,
	Ravi Jonnalagadda <ravis.opensrc@gmail.com>,
	akinobu.mita@gmail.com, damon@lists.linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, akpm@linux-foundation.org,
	corbet@lwn.net, bijan311@gmail.com, ajayjoshi@micron.com,
	honggyu.kim@sk.com, yunjeong.mun@sk.com, rientjes@google.com,
	weixugc@google.com, jic23@kernel.org, gourry@gourry.net,
	Kunwu Chan <kunwu.chan@linux.dev>
Subject: DAMON reporting more hot memory on huge pages (was: "Re: [RFC PATCH v2 0/9] mm/damon: hardware-sampled access reports")
Date: Tue, 15 Sep 2026 22:11:49 -0700	[thread overview]
Message-ID: <20260916051150.107931-1-sj@kernel.org> (raw)
In-Reply-To: <20260916034439.28517-1-lianux.mm@gmail.com>

On Wed, 16 Sep 2026 11:44:30 +0800 "Lian Wang (ProcessMission)" <lianux.mm@gmail.com> wrote:

> Hi SJ,
> 
> Thank you for the questions.  I mixed the original field scenario and our
> controlled reproducer in my previous mail.  I also jumped from the observation
> problem to PMD mapping demotion before explaining why the deployment needs both
> huge pages and finer-grained observation.  That made it sound as if our goal
> was simply to stop using huge pages.
> 
> > The observation makes sense.  However, does the sparse access pattern
> > realistic?  If so, what is the purpose or expected benefit of using huge page
> > for workloads having such access pattern?
> 
> The original case is not a lab-created request to use huge pages for a sparse
> microbenchmark.  It was reported by SXF from a KVM/QEMU deployment where the
> VM has a large memory allocation backed by a shared tmpfs file, host THP is
> enabled, and Oracle runs inside the guest.  They use host-side DAMON to measure
> the VM's hot-memory proportion.  With the same business memory use, they
> observed a much larger hot proportion when THP was enabled.

Thank you for clarifying this.  So I understand it is an issue from a real
world workload.  I'm still curious how sparse the real access pattern in the
real world workload is, and if there is a low haning fruit.  There might be
rooms to improve in their DAMON usage.

Could you share more details about the real world setup and findings?  More
specifically, how they define the hot proportion and how they collect the
number?  What is DAMON setup?  What are the real numbers they saw?

Also, I understand they want to understand real working set size of guests.
Could you further share what they are planning to do with the monitored working
set size?  The required level of accuracy of the monitoring could depend on the
purpose.

> 
> The guest tmpfs 4 KiB/2 MiB writer is their controlled diagnostic case for
> isolating that observation; it is not a claim that the Oracle workload is
> exactly a one-page-per-2-MiB loop.  We then reproduced and quantified the same
> effect on a PC and on the x86 server.
> 
> For this deployment, keeping large pages is a real requirement at the host
> virtualization layer.  QEMU owns a large resident guest-RAM mapping.  Host THP
> allows that mapping to use PMDs and allows KVM to use large secondary mappings,
> reducing host page-table memory, TLB and nested-page-walk pressure, and KVM
> mapping/fault overhead.  These benefits are independent of whether every 4 KiB
> page inside a particular 2 MiB range is hot at one observation time.

Thank you for clarifying this.  Now I understand why they use THP, and I fully
agree they should keep using THP.

[...]
> The performance requirement and monitoring use case come from the deployment,
> not from our lab model.  We will also report the measured Oracle/VM benefit and
> the production access distribution when those data are ready.  The diagnostic
> result establishes the observation mechanism, but it should not substitute for
> those workload-level measurements.

Thanks to your detailed and nice explanation, I don't doubt about the needs to
use huge pages.  So I wouldn't insist on Oracle/VM benefit from huge pages.

I'm still curious the real access distribution, though.  I understand you don't
have the data yet.  It would be very helpful if you could share that in future.

> 
> > I'm not very sure if this is the right direction.  PMD mapping demotion sounds
> > like you just don't want to use huge pages.  If so, you could disable huge
> > pages.
> 
> I agree.  My reasoning in the previous mail was too jumpy: I went from a coarse
> observation directly to a possible MM response, and that obscured the actual
> goal.  PMD mapping demotion is not part of our current proposed solution.  The
> current direction is to keep both the huge folio and PMD mapping unchanged and
> use a genuinely fine-grained access primitive to improve the observation and
> the stat-only decision.  We should first find out whether that is sufficient
> before discussing any mapping change at all.

Thank you for clarifying.  Yes, if you really need sub-pmd access, I believe
the perf event based DAMON could be more useful.  Nonetheless, as I requested
above, knowing the DAMON usage and purpose in more detail might let us finding
a low hanging fruit.

[...]
> With this context clarified, we will return to the immediate work: use the
> existing IBS/perf-event proposal as the concrete strategy under test, and see
> whether its fine-grained evidence can improve the observation and DAMOS
> decision for this case.  We will use the results to test and review this series,
> report both improvements and remaining gaps, and not assume in advance that it
> is the final solution.

That makes sense.  Because Ravi thankfully already implemented this nice
working version prototype, there is no reason to not test it right now.

> 
> I hope this clarifies why keeping huge pages and requesting finer-grained
> observation are not contradictory requirements in this case.

Yes, it is now clear to me.  Thank you for patiently englightening me, Lian.

> 
> If I am still misunderstanding any part of your questions, or if any part of
> this explanation remains unclear, please continue to correct me.  We will keep
> sharing our findings and would like to make sure we are aligned before going
> further.

I believe testing the perf event based monitoring with Ravi's implementation is
a good path forward.

I'm curious about the real setup and results your clients got from their real
world wokload.  But that's not necessarily a blocker of the perf event based
monitoring test.


Thanks,
SJ

[...]

      reply	other threads:[~2026-09-16  5:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 17:16 [RFC PATCH v2 0/9] mm/damon: hardware-sampled access reports Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 1/9] mm/damon/vaddr: support page fault access check primitive Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 2/9] mm/damon/core: read the CPU number with preemption disabled Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 3/9] mm/damon/paddr: lock the folio for the page fault primitive rmap walk Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 4/9] mm/damon: add damos_node_eligible_mem_bp tracepoint Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 5/9] mm/damon/core: add per-probe-class report rings and unified drain Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 6/9] mm/damon: add perf-event overflow handler feeding the report ring Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 7/9] mm/damon/ops-common: use probe-weighted score when probe weights are set Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 8/9] mm/damon: add perf_event prep for PMU-driven hotness probes Ravi Jonnalagadda
2026-09-10 17:16 ` [RFC PATCH v2 9/9] mm/damon/tests/drain-kunit: kunit for report rings and unified drain Ravi Jonnalagadda
2026-09-11  0:34 ` [RFC PATCH v2 0/9] mm/damon: hardware-sampled access reports SJ Park
2026-09-12  1:38 ` SJ Park
2026-09-15 21:23   ` Ravi Jonnalagadda
2026-09-16  0:42     ` SJ Park
2026-09-15  2:54 ` Lian Wang
2026-09-16  0:58   ` SJ Park
2026-09-16  3:44     ` Lian Wang (ProcessMission)
2026-09-16  5:11       ` SJ Park [this message]

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=20260916051150.107931-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=ajayjoshi@micron.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bijan311@gmail.com \
    --cc=corbet@lwn.net \
    --cc=damon@lists.linux.dev \
    --cc=gourry@gourry.net \
    --cc=honggyu.kim@sk.com \
    --cc=jic23@kernel.org \
    --cc=kunwu.chan@linux.dev \
    --cc=lianux.mm@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ravis.opensrc@gmail.com \
    --cc=rientjes@google.com \
    --cc=weixugc@google.com \
    --cc=yunjeong.mun@sk.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

all inboxes | Powered by JetHome®