All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Stepanov Anatoly <stepanov.anatoly@huawei.com>
Cc: SeongJae Park <sj@kernel.org>,
	gutierrez.asier@huawei-partners.com, artem.kuzin@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: [PATCH v1 1/1] mm/damon: support MADV_COLLAPSE via DAMOS_COLLAPSE scheme action
Date: Tue, 31 Mar 2026 17:54:01 -0700	[thread overview]
Message-ID: <20260401005402.85833-1-sj@kernel.org> (raw)
In-Reply-To: <716989f5-78d3-4e78-98ae-2bf3caa447a9@huawei.com>

On Tue, 31 Mar 2026 13:50:21 +0300 Stepanov Anatoly <stepanov.anatoly@huawei.com> wrote:

> On 3/31/2026 1:46 PM, Stepanov Anatoly wrote:
> > On 3/31/2026 4:31 AM, SeongJae Park wrote:
> >> Hello Asier,
> >>
> >> On Mon, 30 Mar 2026 14:57:58 +0000 <gutierrez.asier@huawei-partners.com> wrote:
> >>
> >>> From: Asier Gutierrez <gutierrez.asier@huawei-partners.com>
> >>>
> >>> This patch set introces a new action:  DAMOS_COLLAPSE.
> >>>
> >>> For DAMOS_HUGEPAGE and DAMOS_NOHUGEPAGE to work, khugepaged should be
> >>> working, since it relies on hugepage_madvise to add a new slot. This
> >>> slot should be picked up by khugepaged and eventually collapse (or
> >>> not, if we are using DAMOS_NOHUGEPAGE) the pages. If THP is not
> >>> enabled, khugepaged will not be working, and therefore no collapse
> >>> will happen.
> >>
> >> I should raised this in a previous version, sorry.  But, that is only a half of
> >> the picture.  That is, khugepaged is not the single THP allocator for
> >> MADV_HUGEPAGE.  IIUC, MADV_HUGEPAGE-applied region also allocates huge pages in
> >> page fault time.  According to the man page,
> >>
> >>     The kernel will regularly scan the areas marked as huge page  candidates
> >>     to replace  them with huge pages.  The kernel will also allocate huge pages
> >>     directly when the region is naturally aligned to the huge page size (see
> >>     posix_memalign(2)).
> >>
> > I think key difference between DAMOS_HUGEPAGE and DAMOS_COLLAPSE is the granularity.
> > 
> > In DAMOS_HUGEPAGE case, the granularity is always VMA, even if the hot region is narrow.
> > It's true for both page-fault based collapse and khugepaged collapse.
> *page-fault THP allocation, not collapse of course.

Good point.  I think this difference can also help answering why DAMOS_COLLAPSE
was making less huge pages in the test.

> 
> > 
> > With DAMOS_COLLAPSE we can cover cases, when there's large VMA, for example,
> > which contains some hot VA region inside, so we can collapse just that region, not the whole VMA.

This also makes sense to me.  Also I think this aligns to what we discussed for
MADV_COLLAPSE intro.


Thanks,
SJ

[...]

  reply	other threads:[~2026-04-01  0:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-30 14:57 [PATCH v1 1/1] mm/damon: support MADV_COLLAPSE via DAMOS_COLLAPSE scheme action gutierrez.asier
2026-03-30 23:43 ` (sashiko review) " SeongJae Park
2026-03-31  0:01   ` SeongJae Park
2026-03-31  1:31 ` SeongJae Park
2026-03-31 10:46   ` Stepanov Anatoly
2026-03-31 10:50     ` Stepanov Anatoly
2026-04-01  0:54       ` SeongJae Park [this message]
2026-03-31 15:15   ` Gutierrez Asier
2026-04-01  0:59     ` 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=20260401005402.85833-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 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.