Re: [PATCH v2] mm: thp: fix flags for pmd migration when split
From: Zi Yan
Date: Tue Dec 11 2018 - 14:07:58 EST
On 11 Dec 2018, at 3:21, Konstantin Khlebnikov wrote:
>
> Write/read-only is encoded into migration entry.
> I suppose there should be something like this:
>
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2151,16 +2151,21 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
>
> entry = pmd_to_swp_entry(old_pmd);
> page = pfn_to_page(swp_offset(entry));
> + write = is_write_migration_entry(entry);
> + young = false;
> + soft_dirty = pmd_swp_soft_dirty(old_pmd);
> } else
> #endif
> + {
> page = pmd_page(old_pmd);
> + if (pmd_dirty(old_pmd))
> + SetPageDirty(page);
> + write = pmd_write(old_pmd);
> + young = pmd_young(old_pmd);
> + soft_dirty = pmd_soft_dirty(old_pmd);
> + }
> VM_BUG_ON_PAGE(!page_count(page), page);
> page_ref_add(page, HPAGE_PMD_NR - 1);
> - if (pmd_dirty(old_pmd))
> - SetPageDirty(page);
> - write = pmd_write(old_pmd);
> - young = pmd_young(old_pmd);
> - soft_dirty = pmd_soft_dirty(old_pmd);
>
> /*
> * Withdraw the table only after we mark the pmd entry invalid.
>
This one should fix the issue. Thanks.
Reviewed-by: Zi Yan <zi.yan@xxxxxxxxxxxxxx>
Fixes 84c3fc4e9c563 ("mm: thp: check pmd migration entry in common path")
Do we need to cc: stable@xxxxxxxxxxxxxxx # 4.14+ ?
--
Best Regards,
Yan Zi
Attachment:
signature.asc
Description: OpenPGP digital signature