Re: [PATCH v2 2/2] mm: Remember young/dirty bit for page migrations
From: Peter Xu
Date: Tue Aug 09 2022 - 14:01:02 EST
On Tue, Aug 09, 2022 at 04:40:12PM +0800, Huang, Ying wrote:
> > @@ -2160,6 +2167,12 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
> > entry = pte_wrprotect(entry);
> > if (!young)
> > entry = pte_mkold(entry);
> > + if (dirty)
> > + /*
> > + * NOTE: this may contains setting soft
> > + * dirty too on some archs like x86.
> > + */
>
> Personally, I prefer to put comments above "if (dirty)". But you can
> choose your favorite way unless it violates coding style.
Sure.
>
> > + entry = pte_mkdirty(entry);
>
> We don't track dirty flag even for normal PTE before. So I think we
> should separate the dirty flag tracking for normal PTE in a separate
> patch.
It's kinda convenient to touch that up, but for sure I can split that into
a tiny but separate patch too.
[...]
> I don't find pte_dirty() is synced to PageDirty() as in
> try_to_migrate_one(). Is it a issue in the original code?
I think it has? There is:
/* Set the dirty flag on the folio now the pte is gone. */
if (pte_dirty(pteval))
folio_mark_dirty(folio);
?
Thanks,
--
Peter Xu