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


Groups > linux.kernel > #1516671 > unrolled thread

[PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration

Started byNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
First post2016-11-08 00:40 +0100
Last post2016-11-11 01:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-08 00:40 +0100
    Re: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp  migration Balbir Singh <bsingharora@gmail.com> - 2016-11-10 11:40 +0100
      Re: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp  migration Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> - 2016-11-11 01:00 +0100

#1516671 — [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2016-11-08 00:40 +0100
Subject[PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration
Message-ID<sB1Ga-1xZ-27@gated-at.bofh.it>
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 v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
index 19e796d..6cc8157 100644
--- v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c
+++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
@@ -1485,7 +1485,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);
 }
 
@@ -1687,28 +1697,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.7.0

[toc] | [next] | [standalone]


#1518840 — Re: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration

FromBalbir Singh <bsingharora@gmail.com>
Date2016-11-10 11:40 +0100
SubjectRe: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration
Message-ID<sBUVX-4sp-29@gated-at.bofh.it>
In reply to#1516671

On 08/11/16 10:31, Naoya Horiguchi wrote:
> 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 v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
> index 19e796d..6cc8157 100644
> --- v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c
> +++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
> @@ -1485,7 +1485,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;

Just wondering if new_page() fails, migration of that entry fails. Do we then
split and migrate? I guess this applies to THP migration in general.

Balbir Singh

[toc] | [prev] | [next] | [standalone]


#1519457 — Re: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration

FromNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Date2016-11-11 01:00 +0100
SubjectRe: [PATCH v2 09/12] mm: hwpoison: soft offline supports thp migration
Message-ID<sC7qa-4Sl-15@gated-at.bofh.it>
In reply to#1518840
On Thu, Nov 10, 2016 at 09:31:10PM +1100, Balbir Singh wrote:
> 
> 
> On 08/11/16 10:31, Naoya Horiguchi wrote:
> > 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 v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
> > index 19e796d..6cc8157 100644
> > --- v4.9-rc2-mmotm-2016-10-27-18-27/mm/memory-failure.c
> > +++ v4.9-rc2-mmotm-2016-10-27-18-27_patched/mm/memory-failure.c
> > @@ -1485,7 +1485,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;
> 
> Just wondering if new_page() fails, migration of that entry fails. Do we then
> split and migrate? I guess this applies to THP migration in general.

Yes, that's not implemented yet, but can be helpful.

I think that there are 2 types of callers of page migration,
one is a caller that specifies the target pages individually (like move_pages
and soft offline), and another is a caller that specifies the target pages
by (physical/virtual) address range basis.
Maybe the former ones want to fall back immediately to split and retry if
thp migration fails, and the latter ones want to retry thp migration more.
If this makes sense, we can make some more changes on retry logic to fit
the situation.

Thanks,
Naoya Horiguchi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web