All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] A few fixup and cleanup patches for memory failure
@ 2022-04-14 11:49 Miaohe Lin
  2022-04-14 11:49 ` [PATCH v2 1/2] mm/memory-failure.c: minor cleanup for HWPoisonHandlable Miaohe Lin
  2022-04-14 11:49 ` [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page Miaohe Lin
  0 siblings, 2 replies; 4+ messages in thread
From: Miaohe Lin @ 2022-04-14 11:49 UTC (permalink / raw)
  To: akpm, naoya.horiguchi; +Cc: shy828301, david, linux-mm, linux-kernel, linmiaohe

Hi everyone,
This series contains a patch to clean up the HWPoisonHandlable and another
one to dissolve truncated hugetlb page. More details can be found in the
respective changelogs. Thanks!

---
v2:
  drop patch "mm/memory-failure.c: avoid false-postive PageSwapCache test"
  collect Reviewed-by and Acked-by tag.
  update the comment and enhance the commit log for "mm/memory-failure.c:
    dissolve truncated hugetlb page"
  Thanks David, Yang Shi and Naoya for review!
---
Miaohe Lin (2):
  mm/memory-failure.c: minor cleanup for HWPoisonHandlable
  mm/memory-failure.c: dissolve truncated hugetlb page

 mm/memory-failure.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

-- 
2.23.0


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

* [PATCH v2 1/2] mm/memory-failure.c: minor cleanup for HWPoisonHandlable
  2022-04-14 11:49 [PATCH v2 0/2] A few fixup and cleanup patches for memory failure Miaohe Lin
@ 2022-04-14 11:49 ` Miaohe Lin
  2022-04-14 11:49 ` [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page Miaohe Lin
  1 sibling, 0 replies; 4+ messages in thread
From: Miaohe Lin @ 2022-04-14 11:49 UTC (permalink / raw)
  To: akpm, naoya.horiguchi; +Cc: shy828301, david, linux-mm, linux-kernel, linmiaohe

The local variable movable can be removed by returning true directly. Also
fix typo 'mirgate'. No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
---
 mm/memory-failure.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index e3fbff5bd467..488aaca72340 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1179,13 +1179,11 @@ void ClearPageHWPoisonTakenOff(struct page *page)
  */
 static inline bool HWPoisonHandlable(struct page *page, unsigned long flags)
 {
-	bool movable = false;
-
-	/* Soft offline could mirgate non-LRU movable pages */
+	/* Soft offline could migrate non-LRU movable pages */
 	if ((flags & MF_SOFT_OFFLINE) && __PageMovable(page))
-		movable = true;
+		return true;
 
-	return movable || PageLRU(page) || is_free_buddy_page(page);
+	return PageLRU(page) || is_free_buddy_page(page);
 }
 
 static int __get_hwpoison_page(struct page *page, unsigned long flags)
-- 
2.23.0


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

* [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page
  2022-04-14 11:49 [PATCH v2 0/2] A few fixup and cleanup patches for memory failure Miaohe Lin
  2022-04-14 11:49 ` [PATCH v2 1/2] mm/memory-failure.c: minor cleanup for HWPoisonHandlable Miaohe Lin
@ 2022-04-14 11:49 ` Miaohe Lin
  2022-04-15  1:18   ` HORIGUCHI NAOYA(堀口 直也)
  1 sibling, 1 reply; 4+ messages in thread
From: Miaohe Lin @ 2022-04-14 11:49 UTC (permalink / raw)
  To: akpm, naoya.horiguchi; +Cc: shy828301, david, linux-mm, linux-kernel, linmiaohe

If me_huge_page meets a truncated but not yet freed hugepage, it won't be
dissolved even if we hold the last refcnt. It's because the hugepage has
NULL page_mapping while it's not anonymous hugepage too. Thus we lose the
last chance to dissolve it into buddy to save healthy subpages. Remove
PageAnon check to handle these hugepages too.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory-failure.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 488aaca72340..1d64bfff339d 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1041,12 +1041,11 @@ static int me_huge_page(struct page_state *ps, struct page *p)
 		res = MF_FAILED;
 		unlock_page(hpage);
 		/*
-		 * migration entry prevents later access on error anonymous
-		 * hugepage, so we can free and dissolve it into buddy to
-		 * save healthy subpages.
+		 * migration entry prevents later access on error hugepage,
+		 * so we can free and dissolve it into buddy to save healthy
+		 * subpages.
 		 */
-		if (PageAnon(hpage))
-			put_page(hpage);
+		put_page(hpage);
 		if (__page_handle_poison(p)) {
 			page_ref_inc(p);
 			res = MF_RECOVERED;
-- 
2.23.0


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

* Re: [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page
  2022-04-14 11:49 ` [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page Miaohe Lin
@ 2022-04-15  1:18   ` HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 0 replies; 4+ messages in thread
From: HORIGUCHI NAOYA(堀口 直也) @ 2022-04-15  1:18 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: akpm, shy828301, david, linux-mm, linux-kernel

On Thu, Apr 14, 2022 at 07:49:41PM +0800, Miaohe Lin wrote:
> If me_huge_page meets a truncated but not yet freed hugepage, it won't be
> dissolved even if we hold the last refcnt. It's because the hugepage has
> NULL page_mapping while it's not anonymous hugepage too. Thus we lose the
> last chance to dissolve it into buddy to save healthy subpages. Remove
> PageAnon check to handle these hugepages too.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Thank you for the update.

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

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

end of thread, other threads:[~2022-04-15  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 11:49 [PATCH v2 0/2] A few fixup and cleanup patches for memory failure Miaohe Lin
2022-04-14 11:49 ` [PATCH v2 1/2] mm/memory-failure.c: minor cleanup for HWPoisonHandlable Miaohe Lin
2022-04-14 11:49 ` [PATCH v2 2/2] mm/memory-failure.c: dissolve truncated hugetlb page Miaohe Lin
2022-04-15  1:18   ` HORIGUCHI NAOYA(堀口 直也)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.