public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: Riwan <coefficriwan@gmail.com>
Cc: "Andrew Morton (maintainer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <akpm@linux-foundation.org>,
	"David Hildenbrand (maintainer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <david@kernel.org>,
	"Lorenzo Stoakes (maintainer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <lorenzo.stoakes@oracle.com>,
	"Rik van Riel (reviewer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <riel@surriel.com>,
	"Liam R. Howlett (reviewer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <Liam.Howlett@oracle.com>,
	"Vlastimil Babka (reviewer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <vbabka@suse.cz>,
	"Harry Yoo (reviewer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <harry.yoo@oracle.com>,
	"Jann Horn (reviewer:MEMORY MANAGEMENT - RMAP (REVERSE
	MAPPING))" <jannh@google.com>,
	"Zi Yan (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <ziy@nvidia.com>,
	"Matthew Brost (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <matthew.brost@intel.com>,
	"Joshua Hahn (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <joshua.hahnjy@gmail.com>,
	"Rakie Kim (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <rakie.kim@sk.com>,
	"Byungchul Park (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <byungchul@sk.com>,
	"Ying Huang (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <ying.huang@linux.alibaba.com>,
	"Alistair Popple (reviewer:MEMORY MANAGEMENT - MEMORY POLICY AND
	MIGRATION)" <apopple@nvidia.com>,
	"open list:MEMORY MANAGEMENT - RMAP (REVERSE MAPPING)"
	<linux-mm@kvack.org>, open list <linux-kernel@vger.kernel.org>
Subject: Re: mm/rmap: Should vma_migratable be checked in try_to_migrate_one?
Date: Thu, 12 Mar 2026 12:31:37 -0400	[thread overview]
Message-ID: <abLqaeW-eulG22Eu@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <83E1B606-C461-4FC1-BFF8-FC2BEFDCE2B6@gmail.com>

On Wed, Mar 11, 2026 at 02:46:55PM +0100, Riwan wrote:
> Hi, I’m a phd student working on memory management and I have the following question:
> Is it intentional to not check for `vma_migratable` in `try_to_migrate_one` ?
> If the vma is not migratable, it would be logical to cancel the page migration at this point.
> 
> From what I understand, `vma_migratable` is called to check if a pages in a specific VMA can be migrated or not.
> From what I can see, user-facing migration paths (mbind, move_pages) and NUMA balancing already check wether migration is possible or not with `vma_migratable`, but other migration path, such as compaction with kcompactd, ignore this check.
> As `try_to_migrate_one` is the only place where we have access to the vma (due to reverse mapping), it would be logical to check here for `vma_migratable` (before we only have access to the folio).
> 
> I’m still new to the Linux Kernel, and may have missed critical subsystem / behavior, and I would be curious to know if this was overlooked or if there is a reason behind not calling `vma_migratable`.
> 
> From what I could get, here is the relevant context:
> - Implem of vma_migratable : mm/mempolicy: check hugepage migration is supported by arch in vma_migratable() (https://lore.kernel.org/all/20200402041052.Y4zsoYman%25akpm@linux-foundation.org/)
> - Implem of try_to_migrate_one, previously managed in try_to_unmap_one : mm/rmap: split migration into its own function (https://lore.kernel.org/all/20210701015416.0t4MkxtDR%25akpm@linux-foundation.org/)
> 

Cursory look, it appears that vma_migratable is intended as a shortcut
to determine if an entire given VMA is otherwise not eligible for
migration (if it's backed by dax, then it's assumed the data should
just live there always and forever).

This is different than kcompact and others which touch individual
folios - but will have different ways to determine the same thing.

If you're just trying to migrate one folio, you can get everything you
need mostly from the folio's flags, and so most of the callers you're
concerned about most likely do eactly this.

~Gregory


      reply	other threads:[~2026-03-12 16:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 13:46 mm/rmap: Should vma_migratable be checked in try_to_migrate_one? Riwan
2026-03-12 16:31 ` Gregory Price [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=abLqaeW-eulG22Eu@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=byungchul@sk.com \
    --cc=coefficriwan@gmail.com \
    --cc=david@kernel.org \
    --cc=harry.yoo@oracle.com \
    --cc=jannh@google.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=matthew.brost@intel.com \
    --cc=rakie.kim@sk.com \
    --cc=riel@surriel.com \
    --cc=vbabka@suse.cz \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.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