From: SJ Park <sj@kernel.org>
To: Lian Wang <lianux.mm@gmail.com>
Cc: SJ Park <sj@kernel.org>,
damon@lists.linux.dev, linux-mm@kvack.org,
daichaobing@sangfor.com.cn, kunwu.chan@gmail.com
Subject: Re: [RESEND RFC PATCH v2 4/5] mm/damon: introduce DAMOS_SPLIT action
Date: Thu, 2 Jul 2026 13:00:44 -0700 [thread overview]
Message-ID: <20260702200045.92126-1-sj@kernel.org> (raw)
In-Reply-To: <20260702094633.75658-5-lianux.mm@gmail.com>
On Thu, 2 Jul 2026 17:46:32 +0800 Lian Wang <lianux.mm@gmail.com> wrote:
> Add DAMOS_SPLIT to the damos_action enum for splitting large folios
> into smaller mTHP-order folios. Add a target_order field to struct
> damos to specify the desired split order.
This commit is not adding but reusing the field.
>
> Expose the action as "split" through the DAMON sysfs interface with
> target_order validation (must be 2..HPAGE_PMD_ORDER-1).
>
> Signed-off-by: Lian Wang <lianux.mm@gmail.com>
> Signed-off-by: Lian Wang <lianux.wang@processmission.com>
Let's have only one S-o-b: line if there is no reason to have two.
> ---
> include/linux/damon.h | 9 +++++++--
> mm/damon/sysfs-schemes.c | 16 ++++++++++++++++
> 2 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 5a0587556573..30cf4afb212c 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -121,6 +121,7 @@ struct damon_target {
> * @DAMOS_HUGEPAGE: Call ``madvise()`` for the region with MADV_HUGEPAGE.
> * @DAMOS_NOHUGEPAGE: Call ``madvise()`` for the region with MADV_NOHUGEPAGE.
> * @DAMOS_COLLAPSE: Call ``madvise()`` for the region with MADV_COLLAPSE.
> + * @DAMOS_SPLIT: Split large folios to the target mTHP order.
> * @DAMOS_LRU_PRIO: Prioritize the region on its LRU lists.
> * @DAMOS_LRU_DEPRIO: Deprioritize the region on its LRU lists.
> * @DAMOS_MIGRATE_HOT: Migrate the regions prioritizing warmer regions.
> @@ -141,6 +142,7 @@ enum damos_action {
> DAMOS_HUGEPAGE,
> DAMOS_NOHUGEPAGE,
> DAMOS_COLLAPSE,
> + DAMOS_SPLIT,
> DAMOS_LRU_PRIO,
> DAMOS_LRU_DEPRIO,
> DAMOS_MIGRATE_HOT,
> @@ -573,8 +575,11 @@ struct damos {
> struct damos_access_pattern pattern;
> enum damos_action action;
> /*
> - * @target_order: target order for mTHP actions (DAMOS_COLLAPSE).
> - * 0 means system default (PMD order). Valid: 0, 2..HPAGE_PMD_ORDER.
> + * @target_order: target mTHP order for DAMOS_COLLAPSE and
> + * DAMOS_SPLIT. For COLLAPSE, 0 means PMD order default,
> + * valid values: 0, 2..HPAGE_PMD_ORDER. For SPLIT,
> + * valid values: 2..HPAGE_PMD_ORDER-1; 0 and HPAGE_PMD_ORDER
> + * are rejected at scheme creation time (defaulting to 2).
> */
> unsigned int target_order;
As I commented to an earlier patch, let's use the union.
> unsigned long apply_interval_us;
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 7dcd582ded86..84a4617ca3d3 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
> @@ -2293,6 +2293,10 @@ static struct damos_sysfs_action_name damos_sysfs_action_names[] = {
> .action = DAMOS_COLLAPSE,
> .name = "collapse",
> },
> + {
> + .action = DAMOS_SPLIT,
> + .name = "split",
> + },
> {
> .action = DAMOS_LRU_PRIO,
> .name = "lru_prio",
> @@ -3058,11 +3062,23 @@ static struct damos *damon_sysfs_mk_scheme(
> HPAGE_PMD_ORDER, HPAGE_PMD_ORDER);
> target_order = 0;
> }
> + if (sysfs_scheme->action == DAMOS_SPLIT &&
> + (target_order == 0 ||
> + target_order >= HPAGE_PMD_ORDER)) {
> + pr_warn("DAMON split: target_order %u invalid, need 2..%u. Defaulting to 2.\n",
> + target_order,
> + HPAGE_PMD_ORDER - 1);
> + target_order = 2;
> + }
As I also commented to an earlier patch, this validation will eventually
dropped.
> #else
> if (sysfs_scheme->action == DAMOS_COLLAPSE && target_order != 0) {
> pr_warn("DAMON collapse: target_order not supported without THP. Use 0.\n");
> target_order = 0;
> }
> + if (sysfs_scheme->action == DAMOS_SPLIT) {
> + pr_warn("DAMON split: not supported without THP.\n");
> + target_order = 2;
Why set target_order here?
> + }
> #endif
> scheme->target_order = target_order;
Thanks,
SJ
next prev parent reply other threads:[~2026-07-02 20:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 9:46 [RESEND RFC PATCH v2 0/5] mm/damon: add mTHP collapse and split actions Lian Wang
2026-07-02 9:46 ` [RESEND RFC PATCH v2 1/5] mm/damon: add target_order field for DAMOS_COLLAPSE Lian Wang
2026-07-02 10:01 ` sashiko-bot
2026-07-02 18:51 ` SJ Park
2026-07-02 9:46 ` [RESEND RFC PATCH v2 2/5] mm/khugepaged: add damon_collapse_folio_range() for external callers Lian Wang
2026-07-02 10:13 ` sashiko-bot
2026-07-02 11:07 ` Lorenzo Stoakes
2026-07-02 19:43 ` SJ Park
2026-07-02 20:32 ` SJ Park
2026-07-03 2:06 ` wang lian
2026-07-02 9:46 ` [RESEND RFC PATCH v2 3/5] mm/damon/vaddr: implement mTHP-aware DAMOS_COLLAPSE handler Lian Wang
2026-07-02 10:26 ` sashiko-bot
2026-07-02 19:56 ` SJ Park
2026-07-02 9:46 ` [RESEND RFC PATCH v2 4/5] mm/damon: introduce DAMOS_SPLIT action Lian Wang
2026-07-02 10:41 ` sashiko-bot
2026-07-02 20:00 ` SJ Park [this message]
2026-07-02 9:46 ` [RESEND RFC PATCH v2 5/5] mm/damon/vaddr: implement DAMOS_SPLIT handler Lian Wang
2026-07-02 10:49 ` sashiko-bot
2026-07-02 20:18 ` SJ Park
2026-07-02 10:23 ` [RESEND RFC PATCH v2 0/5] mm/damon: add mTHP collapse and split actions Lorenzo Stoakes
2026-07-02 16:52 ` SJ Park
2026-07-03 19:04 ` SJ Park
2026-07-06 11:59 ` Lorenzo Stoakes
2026-07-03 1:10 ` wang lian
2026-07-03 16:37 ` SJ Park
2026-07-03 1:35 ` wang lian
2026-07-02 18:35 ` SJ Park
2026-07-02 20:50 ` SJ Park
-- strict thread matches above, loose matches on Subject: below --
2026-07-02 9:52 Lian Wang
2026-07-02 9:52 ` [RESEND RFC PATCH v2 4/5] mm/damon: introduce DAMOS_SPLIT action Lian Wang
2026-07-02 10:21 ` sashiko-bot
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=20260702200045.92126-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=daichaobing@sangfor.com.cn \
--cc=damon@lists.linux.dev \
--cc=kunwu.chan@gmail.com \
--cc=lianux.mm@gmail.com \
--cc=linux-mm@kvack.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.