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


Groups > linux.kernel > #1599532

[PATCH v4 08/11] mm: hwpoison: soft offline supports thp migration

From Zi Yan <zi.yan@sent.com>
Newsgroups linux.kernel
Subject [PATCH v4 08/11] mm: hwpoison: soft offline supports thp migration
Date 2017-03-13 16:50 +0100
Message-ID <tkAor-2CJ-41@gated-at.bofh.it> (permalink)
References <tkAop-2CJ-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

This patch enables thp migration for soft offline.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
 mm/memory-failure.c | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b78d08016254..4c9f124c95c8 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1483,7 +1483,17 @@ static struct page *new_page(struct page *p, unsigned long private, int **x)
 	if (PageHuge(p))
 		return alloc_huge_page_node(page_hstate(compound_head(p)),
 						   nid);
-	else
+	else if (thp_migration_supported() && PageTransHuge(p)) {
+		struct page *thp;
+
+		thp = alloc_pages_node(nid,
+			(GFP_TRANSHUGE | __GFP_THISNODE) & ~__GFP_RECLAIM,
+			HPAGE_PMD_ORDER);
+		if (!thp)
+			return NULL;
+		prep_transhuge_page(thp);
+		return thp;
+	} else
 		return __alloc_pages_node(nid, GFP_HIGHUSER_MOVABLE, 0);
 }
 
@@ -1691,28 +1701,11 @@ static int __soft_offline_page(struct page *page, int flags)
 static int soft_offline_in_use_page(struct page *page, int flags)
 {
 	int ret;
-	struct page *hpage = compound_head(page);
-
-	if (!PageHuge(page) && PageTransHuge(hpage)) {
-		lock_page(hpage);
-		if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
-			unlock_page(hpage);
-			if (!PageAnon(hpage))
-				pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page));
-			else
-				pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page));
-			put_hwpoison_page(hpage);
-			return -EBUSY;
-		}
-		unlock_page(hpage);
-		get_hwpoison_page(page);
-		put_hwpoison_page(hpage);
-	}
 
 	if (PageHuge(page))
 		ret = soft_offline_huge_page(page, flags);
 	else
-		ret = __soft_offline_page(page, flags);
+		ret = __soft_offline_page(compound_head(page), flags);
 
 	return ret;
 }
-- 
2.11.0

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


Thread

[PATCH v4 00/11] mm: page migration enhancement for thp Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
  [PATCH v4 09/11] mm: mempolicy: mbind and migrate_pages support thp migration Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
  [PATCH v4 08/11] mm: hwpoison: soft offline supports thp migration Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
  [PATCH v4 05/11] mm: thp: enable thp migration in generic path Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
    Re: [PATCH v4 05/11] mm: thp: enable thp migration in generic path kbuild test robot <lkp@intel.com> - 2017-03-14 22:30 +0100
      Re: [PATCH v4 05/11] mm: thp: enable thp migration in generic path Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-15 10:10 +0100
    Re: [PATCH v4 05/11] mm: thp: enable thp migration in generic path "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-24 15:30 +0100
  [PATCH v4 10/11] mm: migrate: move_pages() supports thp migration Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
  [PATCH v4 01/11] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1 Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
    Re: [PATCH v4 01/11] mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7  to bit 1 Tim Chen <tim.c.chen@linux.intel.com> - 2017-03-24 19:30 +0100
  [PATCH v4 04/11] mm: thp: introduce CONFIG_ARCH_ENABLE_THP_MIGRATION Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100
    Re: [PATCH v4 04/11] mm: thp: introduce  CONFIG_ARCH_ENABLE_THP_MIGRATION "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-24 15:20 +0100
  [PATCH v4 07/11] mm: soft-dirty: keep soft-dirty bits over thp migration Zi Yan <zi.yan@sent.com> - 2017-03-13 16:50 +0100

csiph-web