Re: [PATCH 11/63] mm: Close races between THP migration and PMD numaclearing

From: Mel Gorman
Date: Mon Sep 30 2013 - 11:18:14 EST


On Mon, Sep 30, 2013 at 10:10:48AM -0400, Rik van Riel wrote:
> On Mon, 30 Sep 2013 09:52:59 +0100
> Mel Gorman <mgorman@xxxxxxx> wrote:
>
> > On Fri, Sep 27, 2013 at 02:26:56PM +0100, Mel Gorman wrote:
> > > @@ -1732,9 +1732,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
> > > entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
> > > entry = pmd_mkhuge(entry);
> > >
> > > - page_add_new_anon_rmap(new_page, vma, haddr);
> > > -
> > > + pmdp_clear_flush(vma, address, pmd);
> > > set_pmd_at(mm, haddr, pmd, entry);
> > > + page_add_new_anon_rmap(new_page, vma, haddr);
> > > update_mmu_cache_pmd(vma, address, &entry);
> > > page_remove_rmap(page);
> > > /*
> >
> > pmdp_clear_flush should have used haddr
>
> Dang, we both discovered this over the weekend? :)
>

Saw it this morning running a debugging build.

> In related news, it looks like update_mmu_cache_pmd should
> probably use haddr, too...
>

Does anything care? Other calls to update_mmu_cache_pmd are using address
and not haddr so if this is a problem, it's a problem in a few places. Of
the arches that support THP, only sparc appears to do anything useful and
it shifts the address HPAGE_SHIFT so it does not matter if the address
was aligned or not.

--
Mel Gorman
SUSE Labs
--
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/