Re: [PATCH] mm/hugetlb: fix race when migrate pages.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 19-07-16 19:43:38, zhong jiang wrote:
[...]
>   diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 6384dfd..baba196 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -4213,7 +4213,7 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
>         struct vm_area_struct *svma;
>         unsigned long saddr;
>         pte_t *spte = NULL;
> -       pte_t *pte;
> +       pte_t *pte, entry;
>         spinlock_t *ptl;
> 
>         if (!vma_shareable(vma, addr))
> @@ -4240,6 +4240,11 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
> 
>         ptl = huge_pte_lockptr(hstate_vma(vma), mm, spte);
>         spin_lock(ptl);
> +       entry = huge_ptep_get(spte);
> +       if (is_hugetlb_entry_migration(entry) ||
> +                       is_hugetlb_entry_hwpoisoned(entry)) {
> +               goto end;
> +       }
>         if (pud_none(*pud)) {
>                 pud_populate(mm, pud,
>                                 (pmd_t *)((unsigned long)spte & PAGE_MASK));
> @@ -4247,6 +4252,7 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
>                 put_page(virt_to_page(spte));
>                 mm_dec_nr_pmds(mm);
>         }
> +end:

out_unlock:

would be more readable. Could you retest the patch, respin the changelog
to explain what, why and how to fix it and repost again, please?

>         spin_unlock(ptl);
>  out:
>         pte = (pte_t *)pmd_alloc(mm, pud, addr);
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]