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


Groups > linux.kernel > #1348842

[PATCH v1 10/11] mm: migrate: move_pages() supports thp migration

From Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Newsgroups linux.kernel
Subject [PATCH v1 10/11] mm: migrate: move_pages() supports thp migration
Date 2016-03-03 08:50 +0100
Message-ID <r8wbg-3Mh-19@gated-at.bofh.it> (permalink)
References <r8wbg-3Mh-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch enables thp migration for move_pages(2).

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/migrate.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git v4.5-rc5-mmotm-2016-02-24-16-18/mm/migrate.c v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/migrate.c
index 31bc724..5653d49 100644
--- v4.5-rc5-mmotm-2016-02-24-16-18/mm/migrate.c
+++ v4.5-rc5-mmotm-2016-02-24-16-18_patched/mm/migrate.c
@@ -1240,7 +1240,17 @@ static struct page *new_page_node(struct page *p, unsigned long private,
 	if (PageHuge(p))
 		return alloc_huge_page_node(page_hstate(compound_head(p)),
 					pm->node);
-	else
+	else if (thp_migration_supported() && PageTransHuge(p)) {
+		struct page *thp;
+
+		thp = alloc_pages_node(pm->node,
+			(GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_RECLAIM,
+			HPAGE_PMD_ORDER);
+		if (!thp)
+			return NULL;
+		prep_transhuge_page(thp);
+		return thp;
+	} else
 		return __alloc_pages_node(pm->node,
 				GFP_HIGHUSER_MOVABLE | __GFP_THISNODE, 0);
 }
@@ -1267,6 +1277,7 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
 	for (pp = pm; pp->node != MAX_NUMNODES; pp++) {
 		struct vm_area_struct *vma;
 		struct page *page;
+		unsigned int follflags;
 
 		err = -EFAULT;
 		vma = find_vma(mm, pp->addr);
@@ -1274,8 +1285,10 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
 			goto set_status;
 
 		/* FOLL_DUMP to ignore special (like zero) pages */
-		page = follow_page(vma, pp->addr,
-				FOLL_GET | FOLL_SPLIT | FOLL_DUMP);
+		follflags = FOLL_GET | FOLL_SPLIT | FOLL_DUMP;
+		if (thp_migration_supported())
+			follflags &= ~FOLL_SPLIT;
+		page = follow_page(vma, pp->addr, follflags);
 
 		err = PTR_ERR(page);
 		if (IS_ERR(page))
@@ -1303,6 +1316,11 @@ static int do_move_page_to_node_array(struct mm_struct *mm,
 			if (PageHead(page))
 				isolate_huge_page(page, &pagelist);
 			goto put_and_set;
+		} else if (PageTransCompound(page)) {
+			if (PageTail(page)) {
+				err = pp->node;
+				goto put_and_set;
+			}
 		}
 
 		err = isolate_lru_page(page);
-- 
2.7.0

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


Thread

[PATCH v1 00/11] mm: page migration enhancement for thp Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 07/11] mm: hwpoison: fix race between unpoisoning and freeing migrate source page Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 11/11] mm: memory_hotplug: memory hotremove supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 11/11] mm: memory_hotplug: memory hotremove supports  thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 09:50 +0100
  [PATCH v1 10/11] mm: migrate: move_pages() supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 09/11] mm: mempolicy: mbind and migrate_pages support thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
  [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration kbuild test robot <lkp@intel.com> - 2016-03-03 10:30 +0100
    Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 11:50 +0100
      Re: [PATCH v1 03/11] mm: thp: add helpers related to thp/pmd  migration Naoya Horiguchi <nao.horiguchi@gmail.com> - 2016-03-03 17:30 +0100
  [PATCH v1 02/11] mm: thp: introduce CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 02/11] mm: thp: introduce  CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 11:30 +0100
  [PATCH v1 05/11] mm: thp: check pmd migration entry in common path Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100
    Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common  path "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-03-03 12:00 +0100
      Re: [PATCH v1 05/11] mm: thp: check pmd migration entry in common  path Naoya Horiguchi <nao.horiguchi@gmail.com> - 2016-03-03 17:30 +0100
  [PATCH v1 06/11] mm: soft-dirty: keep soft-dirty bits over thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-03-03 08:50 +0100

csiph-web