From: SeongJae Park <sj@kernel.org>
To: gutierrez.asier@huawei-partners.com
Cc: SeongJae Park <sj@kernel.org>,
artem.kuzin@huawei.com, stepanov.anatoly@huawei.com,
wangkefeng.wang@huawei.com, yanquanmin1@huawei.com,
zuoze1@huawei.com, damon@lists.linux.dev,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v3 3/4] mm/damon: introduce DAMON_HUGEPAGE for hot region hugepage collapsing
Date: Thu, 4 Jun 2026 18:06:19 -0700 [thread overview]
Message-ID: <20260605010620.83004-1-sj@kernel.org> (raw)
In-Reply-To: <20260604150338.501128-4-gutierrez.asier@huawei-partners.com>
On Thu, 4 Jun 2026 15:03:36 +0000 <gutierrez.asier@huawei-partners.com> wrote:
> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
>
> This patch introduces a new DAMON module (SAMPLE_DAMON_HUGEPAGE)
Could we make the name shorter, to look more consistent with other sample
modules? E.g., SAMPLE_DAMON_HPAGE?
> which collapses hot regions into huge pages.
>
> SAMPLE_DAMON_HUGEPAGE operates in the virtual memory space, for a
> specific task. The user is expected to supply the PID of the task
> that is going to be monitored through the monitored_pid module
> variable.
>
> SAMPLE_DAMON_HUGEPAGE uses the hugepage auto-tune mechanism to
> increase or decrease the aggressiveness of page collapsing. User
> autotuning is also available for additional tuning aggressiveness
> control.
>
> The module also includes changes to the DAMON compilation, so that
> the module can be enabled or disabled.
>
> Signed-off-by: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> ---
> mm/damon/Makefile | 8 +-
> samples/damon/Kconfig | 12 ++
> samples/damon/Makefile | 2 +
> samples/damon/hugepage.c (new) | 350 +++++++++++++++++++++++++++++++++
> 4 files changed, 368 insertions(+), 4 deletions(-)
>
> diff --git a/mm/damon/Makefile b/mm/damon/Makefile
> index d8d6bf5f8bff..16459ce40304 100644
> --- a/mm/damon/Makefile
> +++ b/mm/damon/Makefile
> @@ -1,9 +1,9 @@
> # SPDX-License-Identifier: GPL-2.0
>
> -obj-y := core.o
> +obj-y := core.o modules-common.o
> obj-$(CONFIG_DAMON_VADDR) += ops-common.o vaddr.o
> obj-$(CONFIG_DAMON_PADDR) += ops-common.o paddr.o
> obj-$(CONFIG_DAMON_SYSFS) += sysfs-common.o sysfs-schemes.o sysfs.o
> -obj-$(CONFIG_DAMON_RECLAIM) += modules-common.o reclaim.o
> -obj-$(CONFIG_DAMON_LRU_SORT) += modules-common.o lru_sort.o
> -obj-$(CONFIG_DAMON_STAT) += modules-common.o stat.o
> +obj-$(CONFIG_DAMON_RECLAIM) += reclaim.o
> +obj-$(CONFIG_DAMON_LRU_SORT) += lru_sort.o
> +obj-$(CONFIG_DAMON_STAT) += stat.o
This is for letting the new sample module use the code in ops-common.o, right?
I'd like to keep sample modules simple and isolated under samples/ directory.
Could you please make the sample module simpler and remove the above change?
> diff --git a/samples/damon/Kconfig b/samples/damon/Kconfig
> index cbf96fd8a8bf..512f150aaabb 100644
> --- a/samples/damon/Kconfig
> +++ b/samples/damon/Kconfig
> @@ -40,4 +40,16 @@ config SAMPLE_DAMON_MTIER
>
> If unsure, say N.
>
> +config SAMPLE_DAMON_HUGEPAGE
> + bool "Build DAMON-based collapse of hot regions (SAMPLE_DAMON_HUGEPAGE)"
Can this be more consistent with other sample modules? E.g.,
DAMON sample module for auto-tuned THP collapsing ?
> + depends on DAMON && DAMON_VADDR
> + help
> + This module monitors a certain PID provided by the user through
> + monitored_pid attribute. Hot regions are determined by DAMON-based
> + sampling. Collapsing occurs according to the quota goal using total
> + memory usage to huge page usage ratio. The ratio is set by the user
> + through a module attribute.
> +
> + If unsure, say N.
> +
> endmenu
> diff --git a/samples/damon/Makefile b/samples/damon/Makefile
> index 72f68cbf422a..f90845faec85 100644
> --- a/samples/damon/Makefile
> +++ b/samples/damon/Makefile
> @@ -3,3 +3,5 @@
> obj-$(CONFIG_SAMPLE_DAMON_WSSE) += wsse.o
> obj-$(CONFIG_SAMPLE_DAMON_PRCL) += prcl.o
> obj-$(CONFIG_SAMPLE_DAMON_MTIER) += mtier.o
> +obj-$(CONFIG_SAMPLE_DAMON_HUGEPAGE) += hugepage.o
> +ccflags-$(CONFIG_SAMPLE_DAMON_HUGEPAGE) += -I$(srctree)/mm/damon
As I mentioned above, let's not mix samples/ with mm/damon/
> diff --git a/samples/damon/hugepage.c b/samples/damon/hugepage.c
> new file mode 100644
> index 000000000000..e24562c92348
> --- /dev/null
> +++ b/samples/damon/hugepage.c
> @@ -0,0 +1,350 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2026 HUAWEI, Inc.
> + * https://www.huawei.com
> + *
> + * Author: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> + */
> +
> +#define pr_fmt(fmt) "damon-hugepage: " fmt
Apparently this module's source code is following patterns of reclaim.c and
lru_sort.c. That's for non-sample modules. Could you please rewrite this
sample module following patterns in sample modules, like that for wsse.c or
prcl.c ?
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-06-05 1:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 15:03 [RFC PATCH v3 0/4] mm/damon: Introduce a huge page collapsing mechanism using auto tuning gutierrez.asier
2026-06-04 15:03 ` [RFC PATCH v3 1/4] mm/damon: Introduce DAMOS_QUOTA_HUGEPAGE " gutierrez.asier
2026-06-05 0:44 ` SeongJae Park
2026-06-04 15:03 ` [RFC PATCH v3 2/4] mm/damon: Generalize ctx_target creation for damon_ops_id and add vaddr support gutierrez.asier
2026-06-05 0:50 ` SeongJae Park
2026-06-04 15:03 ` [RFC PATCH v3 3/4] mm/damon: introduce DAMON_HUGEPAGE for hot region hugepage collapsing gutierrez.asier
2026-06-05 1:06 ` SeongJae Park [this message]
2026-06-04 15:03 ` [RFC PATCH v3 4/4] Documentation/admin-guide/mm/damon: add DAMON-based Hugepage Management gutierrez.asier
2026-06-05 1:09 ` SeongJae Park
2026-06-05 1:34 ` [RFC PATCH v3 0/4] mm/damon: Introduce a huge page collapsing mechanism using auto tuning 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=20260605010620.83004-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=artem.kuzin@huawei.com \
--cc=damon@lists.linux.dev \
--cc=gutierrez.asier@huawei-partners.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stepanov.anatoly@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=yanquanmin1@huawei.com \
--cc=zuoze1@huawei.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