linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thp: allow a hwpoisoned head page to be put back to LRU
@ 2012-02-20 21:10 Dean Nelson
  2012-02-20 21:29 ` Andrea Arcangeli
  0 siblings, 1 reply; 2+ messages in thread
From: Dean Nelson @ 2012-02-20 21:10 UTC (permalink / raw)
  To: linux-mm; +Cc: Jin Dongming, Andrea Arcangeli, linux-kernel

Andrea Arcangeli pointed out to me that a check in __memory_failure() which
was intended to prevent THP tail pages from being checked for the absence
of the PG_lru flag (something that is always the case), was also preventing
THP head pages from being checked.

A THP head page could actually benefit from the call to shake_page() by
ending up being put back to a LRU, provided it had been waiting in a
pagevec array.

Andrea suggested that the "!PageTransCompound(p)" in the if-statement
should be replaced by a "!PageTransTail(p)", thus allowing THP head pages
to be checked and possibly shaken.

Signed-off-by: Dean Nelson <dnelson@redhat.com>

---
 include/linux/page-flags.h |   20 ++++++++++++++++++++
 mm/memory-failure.c        |    2 +-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e90a673..ca8b626 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -414,11 +414,26 @@ static inline int PageTransHuge(struct page *page)
 	return PageHead(page);
 }
 
+/*
+ * PageTransCompound returns true for both transparent huge pages
+ * and hugetlbfs pages, so it should only be called when it's known
+ * that hugetlbfs pages aren't involved.
+ */
 static inline int PageTransCompound(struct page *page)
 {
 	return PageCompound(page);
 }
 
+/*
+ * PageTransTail returns true for both transparent huge pages
+ * and hugetlbfs pages, so it should only be called when it's known
+ * that hugetlbfs pages aren't involved.
+ */
+static inline int PageTransTail(struct page *page)
+{
+	return PageTail(page);
+}
+
 #else
 
 static inline int PageTransHuge(struct page *page)
@@ -430,6 +445,11 @@ static inline int PageTransCompound(struct page *page)
 {
 	return 0;
 }
+
+static inline int PageTransTail(struct page *page)
+{
+	return 0;
+}
 #endif
 
 #ifdef CONFIG_MMU
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 56080ea..c22076f 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1063,7 +1063,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
 	 * The check (unnecessarily) ignores LRU pages being isolated and
 	 * walked by the page reclaim code, however that's not a big loss.
 	 */
-	if (!PageHuge(p) && !PageTransCompound(p)) {
+	if (!PageHuge(p) && !PageTransTail(p)) {
 		if (!PageLRU(p))
 			shake_page(p, 0);
 		if (!PageLRU(p)) {

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] thp: allow a hwpoisoned head page to be put back to LRU
  2012-02-20 21:10 [PATCH] thp: allow a hwpoisoned head page to be put back to LRU Dean Nelson
@ 2012-02-20 21:29 ` Andrea Arcangeli
  0 siblings, 0 replies; 2+ messages in thread
From: Andrea Arcangeli @ 2012-02-20 21:29 UTC (permalink / raw)
  To: Dean Nelson; +Cc: linux-mm, Jin Dongming, linux-kernel

On Mon, Feb 20, 2012 at 04:10:40PM -0500, Dean Nelson wrote:
> Andrea Arcangeli pointed out to me that a check in __memory_failure() which
> was intended to prevent THP tail pages from being checked for the absence
> of the PG_lru flag (something that is always the case), was also preventing
> THP head pages from being checked.
> 
> A THP head page could actually benefit from the call to shake_page() by
> ending up being put back to a LRU, provided it had been waiting in a
> pagevec array.
> 
> Andrea suggested that the "!PageTransCompound(p)" in the if-statement
> should be replaced by a "!PageTransTail(p)", thus allowing THP head pages
> to be checked and possibly shaken.
> 
> Signed-off-by: Dean Nelson <dnelson@redhat.com>

Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-20 21:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-20 21:10 [PATCH] thp: allow a hwpoisoned head page to be put back to LRU Dean Nelson
2012-02-20 21:29 ` Andrea Arcangeli

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).