Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Enze Li <lienze@kylinos.cn>
Cc: SJ Park <sj@kernel.org>,
	shuah@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/damon/access_memory: disable THP for deterministic access pattern
Date: Sat,  5 Dec 2026 08:49:58 -0800	[thread overview]
Message-ID: <20261205164958.92701-1-sj@kernel.org> (raw)
In-Reply-To: <20261205145917.875356-1-lienze@kylinos.cn>

Hello Enze,

On Sat,  5 Dec 2026 22:59:17 +0800 Enze Li <lienze@kylinos.cn> wrote:

> The WSS estimation selftest always reports zero with a 100% error when
> the system runs with THP='always'.  The reason is that DAMON clears the
> page table Accessed bits but does not flush the TLB.  If the TLB still
> covers the whole workload, the CPU never walks the page table again, so
> DAMON sees no accesses at all.
> 
> Commit 891d206e27dc ("selftests/damon/wss_estimation: test for up to 160
> MiB working set size") tried to fix this by making the workload bigger.
> That only works with base pages, though.  With THP='always', khugepage
> turns the workload into 2MB pages, so even a big working set fits in
> just a few TLB entries.  TLB sizes also differ a lot between CPUs, so
> there is no single working set size that works everywhere.
> 
> On a 4 vCPU / 8 GB x86_64 VM, the test fails with THP='always':
> 
>     50-th percentile error 1.000000 (expect 10485760, result 0)
> 
> Setting THP to 'never' makes it pass at 20MB:
> 
>     50-th percentile error 0.001758 (expect 20971520, result 20934656)
>     75-th percentile error 0.002734 (expect 20971520, result 21028864)
> 
> So make the workload itself predictable: turn off THP for access_memory
> with prctl(PR_SET_THP_DISABLE).  Then it only uses base pages and DAMON
> can see the accesses no matter how the system is configured.  It is a
> process-wide setting, so one call before the allocations is enough.

Awesome, thank you for this patch.

> 
> Signed-off-by: Enze Li <lienze@kylinos.cn>

Reviewed-by: SJ Park <sj@kernel.org>

This patch is applied to damon/next [1] tree.  I will repost it soon (~1 week)
as an mm.git merge request.  So, no action from your side is needed for now.

[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees


Thanks,
SJ

[...]


      reply	other threads:[~2026-12-05 16:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 14:59 [PATCH] selftests/damon/access_memory: disable THP for deterministic access pattern Enze Li
2026-12-05 16:49 ` 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=20261205164958.92701-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=lienze@kylinos.cn \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    /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