diff mbox

[RFC,1/7] mm/hugetlb/migration: Use set_huge_pte_at instead of set_pte_at

Message ID 1491314675-15787-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Aneesh Kumar K.V April 4, 2017, 2:04 p.m. UTC
The right interface to use to set a hugetlb pte entry is set_huge_pte_at. Use
that instead of set_pte_at.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 mm/migrate.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Aneesh Kumar K.V April 4, 2017, 2:07 p.m. UTC | #1
The patch series is not yet send to linux-mm. Once I get feedback on the 
approach used, I will resend this to linux-mm.

Also if there is sufficient interest we could also get nohash hugetlb 
migration to work. But I avoided doing that in this series, because of 
my inability to test the changes.

-aneesh
Anshuman Khandual April 5, 2017, 11:51 a.m. UTC | #2
On 04/04/2017 07:34 PM, Aneesh Kumar K.V wrote:
> The right interface to use to set a hugetlb pte entry is set_huge_pte_at. Use
> that instead of set_pte_at.

This is a generic change, should not mm list be added for this patch.
Aneesh Kumar K.V April 5, 2017, 3:23 p.m. UTC | #3
On Wednesday 05 April 2017 05:21 PM, Anshuman Khandual wrote:
> On 04/04/2017 07:34 PM, Aneesh Kumar K.V wrote:
>> The right interface to use to set a hugetlb pte entry is set_huge_pte_at. Use
>> that instead of set_pte_at.
>
> This is a generic change, should not mm list be added for this patch.
>


yes to all the patches. Look for my reply to patch 1 where I mentioned 
the plan for linux-mm


https://lists.ozlabs.org/pipermail/linuxppc-dev/2017-April/156225.html

-aneesh
Anshuman Khandual April 7, 2017, 10:59 a.m. UTC | #4
On 04/04/2017 07:34 PM, Aneesh Kumar K.V wrote:
> The right interface to use to set a hugetlb pte entry is set_huge_pte_at. Use
> that instead of set_pte_at.
>

Though set_huge_pte_at() calls set_pte_at() on powerpc,
changing this in the generic code makes sense.
diff mbox

Patch

diff --git a/mm/migrate.c b/mm/migrate.c
index 9a0897a14d37..4c272ac6fe53 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -224,25 +224,26 @@  static int remove_migration_pte(struct page *page, struct vm_area_struct *vma,
 		if (is_write_migration_entry(entry))
 			pte = maybe_mkwrite(pte, vma);
 
+		flush_dcache_page(new);
 #ifdef CONFIG_HUGETLB_PAGE
 		if (PageHuge(new)) {
 			pte = pte_mkhuge(pte);
 			pte = arch_make_huge_pte(pte, vma, new, 0);
-		}
-#endif
-		flush_dcache_page(new);
-		set_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte);
-
-		if (PageHuge(new)) {
+			set_huge_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte);
 			if (PageAnon(new))
 				hugepage_add_anon_rmap(new, vma, pvmw.address);
 			else
 				page_dup_rmap(new, true);
-		} else if (PageAnon(new))
-			page_add_anon_rmap(new, vma, pvmw.address, false);
-		else
-			page_add_file_rmap(new, false);
+		} else
+#endif
+		{
+			set_pte_at(vma->vm_mm, pvmw.address, pvmw.pte, pte);
 
+			if (PageAnon(new))
+				page_add_anon_rmap(new, vma, pvmw.address, false);
+			else
+				page_add_file_rmap(new, false);
+		}
 		if (vma->vm_flags & VM_LOCKED && !PageTransCompound(new))
 			mlock_vma_page(new);