Re: [patch 1/3] [PATCH] mm: migration -- Do not loose soft dirty bitif page is in migration state

From: Naoya Horiguchi
Date: Tue Oct 08 2013 - 10:48:40 EST


On Tue, Oct 08, 2013 at 06:40:30PM +0400, Cyrill Gorcunov wrote:
> On Tue, Oct 08, 2013 at 10:11:40AM -0400, Naoya Horiguchi wrote:
> > > Index: linux-2.6.git/mm/memory.c
> > > ===================================================================
> > > --- linux-2.6.git.orig/mm/memory.c
> > > +++ linux-2.6.git/mm/memory.c
> > > @@ -837,6 +837,8 @@ copy_one_pte(struct mm_struct *dst_mm, s
> > > */
> > > make_migration_entry_read(&entry);
> > > pte = swp_entry_to_pte(entry);
> > > + if (pte_swp_soft_dirty(*src_pte))
> > > + pte = pte_swp_mksoft_dirty(pte);
> > > set_pte_at(src_mm, addr, src_pte, pte);
> > > }
> > > }
> >
> > When we convert pte to swap_entry, we convert soft-dirty bit in
> > pte_to_swp_entry(). So I think that it's better to convert it back
> > in swp_entry_to_pte() when we do swap_entry-to-pte conversion.
>
> No, soft dirty bit lays _only_ inside pte entry in memory, iow
> swp_entry_t never has this bit, thus to be able to find soft dirty
> status in swp_entry_to_pte you need to extend this function and
> pass pte entry itself as an argument, which eventually will bring
> more massive patch and will be a way more confusing I think.

OK, you're right. Thanks for explanation.

> Or I misunderstood you?

No, I misread the code, sorry.

Naoya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/