linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Zi Yan <zi.yan@sent.com>
Cc: kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	minchan@kernel.org, vbabka@suse.cz, mgorman@techsingularity.net,
	mhocko@kernel.org, khandual@linux.vnet.ibm.com,
	zi.yan@cs.rutgers.edu, dnellans@nvidia.com,
	dave.hansen@intel.com, n-horiguchi@ah.jp.nec.com
Subject: Re: [PATCH v7 06/10] mm: thp: check pmd migration entry in common path
Date: Wed, 21 Jun 2017 14:49:20 +0300	[thread overview]
Message-ID: <20170621114920.mmbexy4dbgbb4juq@node.shutemov.name> (raw)
In-Reply-To: <20170620230715.81590-7-zi.yan@sent.com>

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

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

  reply	other threads:[~2017-06-21 11:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20 23:07 [PATCH v7 00/10] mm: page migration enhancement for thp Zi Yan
2017-06-20 23:07 ` [PATCH v7 01/10] mm: mempolicy: add queue_pages_required() Zi Yan
2017-06-20 23:07 ` [PATCH v7 02/10] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1 Zi Yan
2017-06-20 23:07 ` [PATCH v7 03/10] mm: thp: introduce separate TTU flag for thp freezing Zi Yan
2017-06-20 23:07 ` [PATCH v7 04/10] mm: thp: introduce CONFIG_ARCH_ENABLE_THP_MIGRATION Zi Yan
2017-06-20 23:07 ` [PATCH v7 05/10] mm: thp: enable thp migration in generic path Zi Yan
2017-06-21 11:23   ` Kirill A. Shutemov
2017-06-21 14:37     ` Zi Yan
2017-06-21 14:50       ` Kirill A. Shutemov
2017-06-21 14:59         ` Zi Yan
2017-06-20 23:07 ` [PATCH v7 06/10] mm: thp: check pmd migration entry in common path Zi Yan
2017-06-21 11:49   ` Kirill A. Shutemov [this message]
2017-06-21 14:42     ` Zi Yan
2017-06-20 23:07 ` [PATCH v7 07/10] mm: soft-dirty: keep soft-dirty bits over thp migration Zi Yan
2017-06-20 23:07 ` [PATCH v7 08/10] mm: mempolicy: mbind and migrate_pages support " Zi Yan
2017-06-20 23:07 ` [PATCH v7 09/10] mm: migrate: move_pages() supports " Zi Yan
2017-06-20 23:07 ` [PATCH v7 10/10] mm: memory_hotplug: memory hotremove " Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170621114920.mmbexy4dbgbb4juq@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=dnellans@nvidia.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=minchan@kernel.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=vbabka@suse.cz \
    --cc=zi.yan@cs.rutgers.edu \
    --cc=zi.yan@sent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox