Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb
@ 2026-05-13  2:48 Ye Liu
  2026-05-13  3:36 ` Oscar Salvador
  0 siblings, 1 reply; 4+ messages in thread
From: Ye Liu @ 2026-05-13  2:48 UTC (permalink / raw)
  To: Miaohe Lin, Andrew Morton; +Cc: Ye Liu, Naoya Horiguchi, linux-mm, linux-kernel

From: Ye Liu <liuye@kylinos.cn>

The hugetlb indicator in try_memory_failure_hugetlb is a Boolean
flag, but was declared and assigned as int/0/1. Convert to `bool`
and `true`/`false` for clarity and type safety.

- try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb)
- testcase path in memory_failure(): bool hugetlb = false
- clear semantic conversion in MF_HUGETLB_NON_HUGEPAGE
- preserve behavior (no functional change)

Signed-off-by: Ye Liu <liuye@kylinos.cn>
Acked-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/memory-failure.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 866c4428ac7e..f164fc5959f0 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2032,7 +2032,7 @@ int __get_huge_page_for_hwpoison(unsigned long pfn, int flags,
  *	-EHWPOISON	- folio or exact page already poisoned
  *	-EFAULT		- kill_accessing_process finds current->mm null
  */
-static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb)
+static int try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb)
 {
 	int res, rv;
 	struct page *p = pfn_to_page(pfn);
@@ -2040,12 +2040,12 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
 	unsigned long page_flags;
 	bool migratable_cleared = false;
 
-	*hugetlb = 1;
+	*hugetlb = true;
 retry:
 	res = get_huge_page_for_hwpoison(pfn, flags, &migratable_cleared);
 	switch (res) {
 	case MF_HUGETLB_NON_HUGEPAGE:	/* fallback to normal page handling */
-		*hugetlb = 0;
+		*hugetlb = false;
 		return 0;
 	case MF_HUGETLB_RETRY:
 		if (!(flags & MF_NO_RETRY)) {
@@ -2107,7 +2107,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
 }
 
 #else
-static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb)
+static inline int try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb)
 {
 	return 0;
 }
@@ -2347,7 +2347,7 @@ int memory_failure(unsigned long pfn, int flags)
 	int res = 0;
 	unsigned long page_flags;
 	bool retry = true;
-	int hugetlb = 0;
+	bool hugetlb = false;
 
 	if (!sysctl_memory_failure_recovery)
 		panic("Memory failure on page %lx", pfn);
-- 
2.43.0



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

end of thread, other threads:[~2026-05-13  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13  2:48 [RESEND PATCH] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb Ye Liu
2026-05-13  3:36 ` Oscar Salvador
2026-05-13  6:50   ` Ye Liu
2026-05-13  8:38     ` Oscar Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox