lkml.org 
[lkml]   [2022]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 5/7] mm: Remember young/dirty bit for page migrations
On Tue, Aug 09, 2022 at 06:00:58PM -0400, Peter Xu wrote:
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index 27fb37d65476..699f821b8443 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -221,6 +221,10 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
> else
> entry = make_readable_migration_entry(
> page_to_pfn(page));
> + if (pte_young(pte))
> + entry = make_migration_entry_young(entry);
> + if (pte_dirty(pte))
> + entry = make_migration_entry_dirty(entry);
> swp_pte = swp_entry_to_pte(entry);
> if (pte_present(pte)) {
> if (pte_soft_dirty(pte))

This change needs to be wrapped with pte_present() at least..

I also just noticed that this change probably won't help anyway because:

(1) When ram->device, the pte will finally be replaced with a device
private entry, and device private entry does not yet support A/D, it
means A/D will be dropped again,

(2) When device->ram, we are missing information on either A/D bits, or
even if device private entries start to suport A/D, it's still not
clear whether we should take device read/write into considerations
too on the page A/D bits to be accurate.

I think I'll probably keep the code there for completeness, but I think it
won't really help much until more things are done.

--
Peter Xu

\
 
 \ /
  Last update: 2022-08-11 17:20    [W:0.586 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site