Skip to content

Commit 385de35

Browse files
dnlsntorvalds
authored andcommitted
thp: allow a hwpoisoned head page to be put back to LRU
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> Cc: Jin Dongming <jin.dongming@np.css.fujitsu.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6d9d88d commit 385de35

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

include/linux/page-flags.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,26 @@ static inline int PageTransHuge(struct page *page)
414414
return PageHead(page);
415415
}
416416

417+
/*
418+
* PageTransCompound returns true for both transparent huge pages
419+
* and hugetlbfs pages, so it should only be called when it's known
420+
* that hugetlbfs pages aren't involved.
421+
*/
417422
static inline int PageTransCompound(struct page *page)
418423
{
419424
return PageCompound(page);
420425
}
421426

427+
/*
428+
* PageTransTail returns true for both transparent huge pages
429+
* and hugetlbfs pages, so it should only be called when it's known
430+
* that hugetlbfs pages aren't involved.
431+
*/
432+
static inline int PageTransTail(struct page *page)
433+
{
434+
return PageTail(page);
435+
}
436+
422437
#else
423438

424439
static inline int PageTransHuge(struct page *page)
@@ -430,6 +445,11 @@ static inline int PageTransCompound(struct page *page)
430445
{
431446
return 0;
432447
}
448+
449+
static inline int PageTransTail(struct page *page)
450+
{
451+
return 0;
452+
}
433453
#endif
434454

435455
#ifdef CONFIG_MMU

mm/memory-failure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
10631063
* The check (unnecessarily) ignores LRU pages being isolated and
10641064
* walked by the page reclaim code, however that's not a big loss.
10651065
*/
1066-
if (!PageHuge(p) && !PageTransCompound(p)) {
1066+
if (!PageHuge(p) && !PageTransTail(p)) {
10671067
if (!PageLRU(p))
10681068
shake_page(p, 0);
10691069
if (!PageLRU(p)) {

0 commit comments

Comments
 (0)