Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671626

Re: [PATCH v7 06/10] mm: thp: check pmd migration entry in common path

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH v7 06/10] mm: thp: check pmd migration entry in common path
Date 2017-06-21 13:50 +0200
Message-ID <tUMiZ-5zv-9@gated-at.bofh.it> (permalink)
References <tUABb-6zP-7@gated-at.bofh.it> <tUABc-6zP-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 20, 2017 at 07:07:11PM -0400, Zi Yan wrote:
> @@ -1220,6 +1238,9 @@ int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd)
>  	if (unlikely(!pmd_same(*vmf->pmd, orig_pmd)))
>  		goto out_unlock;
>  
> +	if (unlikely(!pmd_present(orig_pmd)))
> +		goto out_unlock;
> +

Hm. Shouldn't we wait for the page here?

>  	page = pmd_page(orig_pmd);
>  	VM_BUG_ON_PAGE(!PageCompound(page) || !PageHead(page), page);
>  	/*
> @@ -1556,6 +1577,12 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
>  	if (is_huge_zero_pmd(orig_pmd))
>  		goto out;
>  
> +	if (unlikely(!pmd_present(orig_pmd))) {
> +		VM_BUG_ON(IS_ENABLED(CONFIG_MIGRATION) &&
> +				  !is_pmd_migration_entry(orig_pmd));
> +		goto out;
> +	}
> +
>  	page = pmd_page(orig_pmd);
>  	/*
>  	 * If other processes are mapping this page, we couldn't discard
> @@ -1770,6 +1797,23 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
>  	preserve_write = prot_numa && pmd_write(*pmd);
>  	ret = 1;
>  
> +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
> +	if (is_swap_pmd(*pmd)) {
> +		swp_entry_t entry = pmd_to_swp_entry(*pmd);
> +
> +		VM_BUG_ON(IS_ENABLED(CONFIG_MIGRATION) &&
> +				  !is_pmd_migration_entry(*pmd));
> +		if (is_write_migration_entry(entry)) {
> +			pmd_t newpmd;
> +
> +			make_migration_entry_read(&entry);
> +			newpmd = swp_entry_to_pmd(entry);
> +			set_pmd_at(mm, addr, pmd, newpmd);

I was confused by this. Could you copy comment from change_pte_range()
here?

> +		}
> +		goto unlock;
> +	}
> +#endif
> +
>  	/*
>  	 * Avoid trapping faults against the zero page. The read-only
>  	 * data is likely to be read-cached on the local CPU and

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 00/10] mm: page migration enhancement for thp Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
  [PATCH v7 04/10] mm: thp: introduce CONFIG_ARCH_ENABLE_THP_MIGRATION Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
  [PATCH v7 02/10] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1 Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
  [PATCH v7 08/10] mm: mempolicy: mbind and migrate_pages support thp migration Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
  [PATCH v7 06/10] mm: thp: check pmd migration entry in common path Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
    Re: [PATCH v7 06/10] mm: thp: check pmd migration entry in common  path "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-06-21 13:50 +0200
      Re: [PATCH v7 06/10] mm: thp: check pmd migration entry in common  path "Zi Yan" <zi.yan@sent.com> - 2017-06-21 16:50 +0200
  [PATCH v7 07/10] mm: soft-dirty: keep soft-dirty bits over thp migration Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
  [PATCH v7 05/10] mm: thp: enable thp migration in generic path Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200
    Re: [PATCH v7 05/10] mm: thp: enable thp migration in generic path "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-06-21 13:30 +0200
      Re: [PATCH v7 05/10] mm: thp: enable thp migration in generic path "Zi Yan" <zi.yan@sent.com> - 2017-06-21 16:40 +0200
        Re: [PATCH v7 05/10] mm: thp: enable thp migration in generic path "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-06-21 17:00 +0200
          Re: [PATCH v7 05/10] mm: thp: enable thp migration in generic path "Zi Yan" <zi.yan@sent.com> - 2017-06-21 17:00 +0200
  [PATCH v7 10/10] mm: memory_hotplug: memory hotremove supports thp migration Zi Yan <zi.yan@sent.com> - 2017-06-21 01:20 +0200

csiph-web