Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627828 > unrolled thread
| Started by | Zi Yan <zi.yan@sent.com> |
|---|---|
| First post | 2017-04-20 23:10 +0200 |
| Last post | 2017-04-21 10:20 +0200 |
| Articles | 2 — 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.
[PATCH v5 08/11] mm: hwpoison: soft offline supports thp migration Zi Yan <zi.yan@sent.com> - 2017-04-20 23:10 +0200
Re: [PATCH v5 08/11] mm: hwpoison: soft offline supports thp migration Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-04-21 10:20 +0200
| From | Zi Yan <zi.yan@sent.com> |
|---|---|
| Date | 2017-04-20 23:10 +0200 |
| Subject | [PATCH v5 08/11] mm: hwpoison: soft offline supports thp migration |
| Message-ID | <tyruW-5v5-23@gated-at.bofh.it> |
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>
ChangeLog: v1 -> v5:
- fix page isolation counting error
Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
---
mm/memory-failure.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9b77476ef31f..23ff02eb3ed4 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1481,7 +1481,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);
}
@@ -1665,8 +1675,8 @@ static int __soft_offline_page(struct page *page, int flags)
* cannot have PAGE_MAPPING_MOVABLE.
*/
if (!__PageMovable(page))
- inc_node_page_state(page, NR_ISOLATED_ANON +
- page_is_file_cache(page));
+ mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON +
+ page_is_file_cache(page), hpage_nr_pages(page));
list_add(&page->lru, &pagelist);
ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
MIGRATE_SYNC, MR_MEMORY_FAILURE);
@@ -1689,28 +1699,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
[toc] | [next] | [standalone]
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-04-21 10:20 +0200 |
| Subject | Re: [PATCH v5 08/11] mm: hwpoison: soft offline supports thp migration |
| Message-ID | <tyBXj-3uU-5@gated-at.bofh.it> |
| In reply to | #1627828 |
On 04/21/2017 02:17 AM, Zi Yan wrote:
> 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>
>
> ChangeLog: v1 -> v5:
> - fix page isolation counting error
>
> Signed-off-by: Zi Yan <zi.yan@cs.rutgers.edu>
> ---
> mm/memory-failure.c | 35 ++++++++++++++---------------------
> 1 file changed, 14 insertions(+), 21 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 9b77476ef31f..23ff02eb3ed4 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1481,7 +1481,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,
Why not __GFP_RECLAIM ? Its soft offline path we wait a bit before
declaring that THP page cannot be allocated and hence should invoke
reclaim methods as well.
> + HPAGE_PMD_ORDER);
> + if (!thp)
> + return NULL;
> + prep_transhuge_page(thp);
> + return thp;
> + } else
> return __alloc_pages_node(nid, GFP_HIGHUSER_MOVABLE, 0);
> }
>
> @@ -1665,8 +1675,8 @@ static int __soft_offline_page(struct page *page, int flags)
> * cannot have PAGE_MAPPING_MOVABLE.
> */
> if (!__PageMovable(page))
> - inc_node_page_state(page, NR_ISOLATED_ANON +
> - page_is_file_cache(page));
> + mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON +
> + page_is_file_cache(page), hpage_nr_pages(page));
> list_add(&page->lru, &pagelist);
> ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL,
> MIGRATE_SYNC, MR_MEMORY_FAILURE);
> @@ -1689,28 +1699,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);
Hmm, what if the THP allocation fails in the new_page() path and
we fallback for general page allocation. In that case we will
always be still calling with the head page ? Because we dont
split the huge page any more.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web