linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: n-horiguchi@ah.jp.nec.com, akpm@linux-foundation.org,
	aneesh.kumar@linux.vnet.ibm.com
Subject: [PATCH] mm/madvise: Dont poison entire HugeTLB page for single page errors
Date: Thu, 20 Apr 2017 16:36:27 +0530	[thread overview]
Message-ID: <20170420110627.12307-1-khandual@linux.vnet.ibm.com> (raw)
In-Reply-To: <893ecbd7-e9fa-7a54-fc62-43f8a5b8107f@linux.vnet.ibm.com>

Currently soft_offline_page() migrates the entire HugeTLB page, then
dequeues it from the active list by making it a dangling HugeTLB page
which ofcourse can not be used further and marks the entire HugeTLB
page as poisoned. This might be a costly waste of memory if the error
involved affects only small section of the entire page.

This changes the behaviour so that only the affected page is marked
poisoned and then the HugeTLB page is released back to buddy system.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
The number of poisoned pages on the system has reduced as seen from
dmesg triggered with 'echo m > /proc/sysrq-enter' on powerpc.

 include/linux/hugetlb.h | 1 +
 mm/hugetlb.c            | 2 +-
 mm/memory-failure.c     | 9 ++++-----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 7a5917d..f6b80a4 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -470,6 +470,7 @@ static inline pgoff_t basepage_index(struct page *page)
 	return __basepage_index(page);
 }
 
+extern int dissolve_free_huge_page(struct page *page);
 extern int dissolve_free_huge_pages(unsigned long start_pfn,
 				    unsigned long end_pfn);
 static inline bool hugepage_migration_supported(struct hstate *h)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 1edfdb8..2fb9ba3 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1444,7 +1444,7 @@ static int free_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed,
  * number of free hugepages would be reduced below the number of reserved
  * hugepages.
  */
-static int dissolve_free_huge_page(struct page *page)
+int dissolve_free_huge_page(struct page *page)
 {
 	int rc = 0;
 
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 27f7210..1e377fd 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1597,13 +1597,12 @@ static int soft_offline_huge_page(struct page *page, int flags)
 			ret = -EIO;
 	} else {
 		/* overcommit hugetlb page will be freed to buddy */
+		SetPageHWPoison(page);
+		num_poisoned_pages_inc();
+
 		if (PageHuge(page)) {
-			set_page_hwpoison_huge_page(hpage);
 			dequeue_hwpoisoned_huge_page(hpage);
-			num_poisoned_pages_add(1 << compound_order(hpage));
-		} else {
-			SetPageHWPoison(page);
-			num_poisoned_pages_inc();
+			dissolve_free_huge_page(hpage);
 		}
 	}
 	return ret;
-- 
1.8.5.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-04-20 11:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  3:27 [RFC] mm/madvise: Enable (soft|hard) offline of HugeTLB pages at PGD level Anshuman Khandual
2017-04-19  6:20 ` Aneesh Kumar K.V
2017-04-19  6:42   ` Anshuman Khandual
2017-04-20  5:05     ` Anshuman Khandual
2017-04-20 11:06       ` Anshuman Khandual [this message]
2017-04-20 13:48         ` [PATCH] mm/madvise: Dont poison entire HugeTLB page for single page errors kbuild test robot
2017-05-12  8:10         ` Naoya Horiguchi
2017-05-14  2:34           ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170420110627.12307-1-khandual@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).