linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Zi Yan" <zi.yan@sent.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
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,
	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 10:42:41 -0400	[thread overview]
Message-ID: <0FF04F05-088F-413A-8F35-21668F520AC0@sent.com> (raw)
In-Reply-To: <20170621114920.mmbexy4dbgbb4juq@node.shutemov.name>

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

On 21 Jun 2017, at 7:49, Kirill A. Shutemov wrote:

> 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?

Thanks for pointing this out.

This chunk is unnecessary, since do_huge_pmd_wp_page() is called by wp_huge_pmd(),
which is called only when orig_pmd is present. Thus, this code is useless.
And pmd_same() will also preclude vmf->pmd from not present.


>>  	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?

Sure. Will do.

>> +		}
>> +		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

Thanks for your review.

--
Best Regards
Yan Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 496 bytes --]

  reply	other threads:[~2017-06-21 14:42 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
2017-06-21 14:42     ` Zi Yan [this message]
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=0FF04F05-088F-413A-8F35-21668F520AC0@sent.com \
    --to=zi.yan@sent.com \
    --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=kirill@shutemov.name \
    --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 \
    /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