lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aHv9FeQDsrAvCh3W@lstrano-desk.jf.intel.com>
Date: Sat, 19 Jul 2025 13:16:21 -0700
From: Matthew Brost <matthew.brost@...el.com>
To: Balbir Singh <balbirs@...dia.com>
CC: Alistair Popple <apopple@...dia.com>, <linux-mm@...ck.org>,
	<akpm@...ux-foundation.org>, <linux-kernel@...r.kernel.org>, Karol Herbst
	<kherbst@...hat.com>, Lyude Paul <lyude@...hat.com>, Danilo Krummrich
	<dakr@...nel.org>, David Airlie <airlied@...il.com>, Simona Vetter
	<simona@...ll.ch>, Jérôme Glisse <jglisse@...hat.com>,
	Shuah Khan <shuah@...nel.org>, David Hildenbrand <david@...hat.com>, "Barry
 Song" <baohua@...nel.org>, Baolin Wang <baolin.wang@...ux.alibaba.com>, "Ryan
 Roberts" <ryan.roberts@....com>, Matthew Wilcox <willy@...radead.org>, "Peter
 Xu" <peterx@...hat.com>, Zi Yan <ziy@...dia.com>, Kefeng Wang
	<wangkefeng.wang@...wei.com>, Jane Chu <jane.chu@...cle.com>, Donet Tom
	<donettom@...ux.ibm.com>
Subject: Re: [v1 resend 02/12] mm/migrate_device: flags for selecting device
 private THP pages

On Sat, Jul 19, 2025 at 01:06:21PM -0700, Matthew Brost wrote:
> On Tue, Jul 08, 2025 at 05:31:49PM +1000, Balbir Singh wrote:
> > On 7/7/25 15:31, Alistair Popple wrote:
> > > On Fri, Jul 04, 2025 at 09:35:01AM +1000, Balbir Singh wrote:
> > >> Add flags to mark zone device migration pages.
> > >>
> > >> MIGRATE_VMA_SELECT_COMPOUND will be used to select THP pages during
> > >> migrate_vma_setup() and MIGRATE_PFN_COMPOUND will make migrating
> > >> device pages as compound pages during device pfn migration.
> > >>
> > >> Cc: Karol Herbst <kherbst@...hat.com>
> > >> Cc: Lyude Paul <lyude@...hat.com>
> > >> Cc: Danilo Krummrich <dakr@...nel.org>
> > >> Cc: David Airlie <airlied@...il.com>
> > >> Cc: Simona Vetter <simona@...ll.ch>
> > >> Cc: "Jérôme Glisse" <jglisse@...hat.com>
> > >> Cc: Shuah Khan <shuah@...nel.org>
> > >> Cc: David Hildenbrand <david@...hat.com>
> > >> Cc: Barry Song <baohua@...nel.org>
> > >> Cc: Baolin Wang <baolin.wang@...ux.alibaba.com>
> > >> Cc: Ryan Roberts <ryan.roberts@....com>
> > >> Cc: Matthew Wilcox <willy@...radead.org>
> > >> Cc: Peter Xu <peterx@...hat.com>
> > >> Cc: Zi Yan <ziy@...dia.com>
> > >> Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
> > >> Cc: Jane Chu <jane.chu@...cle.com>
> > >> Cc: Alistair Popple <apopple@...dia.com>
> > >> Cc: Donet Tom <donettom@...ux.ibm.com>
> > >>
> > >> Signed-off-by: Balbir Singh <balbirs@...dia.com>
> > >> ---
> > >>  include/linux/migrate.h | 2 ++
> > >>  1 file changed, 2 insertions(+)
> > >>
> > >> diff --git a/include/linux/migrate.h b/include/linux/migrate.h
> > >> index aaa2114498d6..1661e2d5479a 100644
> > >> --- a/include/linux/migrate.h
> > >> +++ b/include/linux/migrate.h
> > >> @@ -167,6 +167,7 @@ static inline int migrate_misplaced_folio(struct folio *folio, int node)
> > >>  #define MIGRATE_PFN_VALID	(1UL << 0)
> > >>  #define MIGRATE_PFN_MIGRATE	(1UL << 1)
> > >>  #define MIGRATE_PFN_WRITE	(1UL << 3)
> > >> +#define MIGRATE_PFN_COMPOUND	(1UL << 4)
> > > 
> > > Why is this necessary? Couldn't migrate_vma just use folio_order() to figure out
> > > if it's a compound page or not?
> > > 
> > 
> > I can definitely explore that angle. As we move towards mTHP, we'll need additional bits for the various order sizes as well.
> > 
> 
> I agree you probably could get away without having an explict mpfn flag
> for compound pages and rely on the folio order everywhere.
> 

Actually, I thought of one case where this is a bit useful—when a PMD is
not faulted during the call to migrate_vma_setup in a RAM → VRAM
migration. This communicates back to the caller that it can create a THP
device page. I suppose the caller could infer this based on the src
entries being unpopulated, but I thought it was worth bringing up this
case.

Not sure the MIGRATE_PFN_COMPOUND flag alone helps in the above scenario
with mTHP though. In that case, you'd probably need the order to be
encoded in the MFN as well.

Matt 

> Matt
> 
> > Balbir Singh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ