On Mon, Mar 18, 2013 at 03:51:59PM +0100, Michal Hocko wrote:
> On Thu 21-02-13 14:41:40, Naoya Horiguchi wrote:
> [...]
> > diff --git v3.8.orig/mm/migrate.c v3.8/mm/migrate.c
> > index 2fd8b4a..7d84f4c 100644
> > --- v3.8.orig/mm/migrate.c
> > +++ v3.8/mm/migrate.c
> > @@ -236,6 +236,30 @@ void migration_entry_wait(struct mm_struct *mm, pmd_t 
> > *pmd,
> >     pte_unmap_unlock(ptep, ptl);
> >  }
> >  
> > +void migration_entry_wait_huge(struct mm_struct *mm, pmd_t *pmd,
> > +                           unsigned long address)
> > +{
> > +   spinlock_t *ptl = pte_lockptr(mm, pmd);
> > +   pte_t pte;
> > +   swp_entry_t entry;
> > +   struct page *page;
> > +
> > +   spin_lock(ptl);
> > +   pte = huge_ptep_get((pte_t *)pmd);
> > +   if (!is_hugetlb_entry_migration(pte))
> > +           goto out;
> > +   entry = pte_to_swp_entry(pte);
> > +   page = migration_entry_to_page(entry);
> > +   if (!get_page_unless_zero(page))
> > +           goto out;
> > +   spin_unlock(ptl);
> > +   wait_on_page_locked(page);
> > +   put_page(page);
> > +   return;
> > +out:
> > +   spin_unlock(ptl);
> > +}
> 
> This duplicates a lot of code from migration_entry_wait. Can we just
> teach the generic one to be HugePage aware instead?
> All it takes is just opencoding pte_offset_map_lock and calling
> huge_ptep_get ofr HugePage and pte_offset_map otherwise.

Yes, it's possible with some cleanup. I'll do this.

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

Reply via email to