linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/memory-failure: use bool for forcekill state
@ 2026-04-10  7:47 Ye Liu
  0 siblings, 0 replies; only message in thread
From: Ye Liu @ 2026-04-10  7:47 UTC (permalink / raw)
  To: Miaohe Lin, Andrew Morton; +Cc: Ye Liu, Naoya Horiguchi, linux-mm, linux-kernel

From: Ye Liu <liuye@kylinos.cn>

'forcekill' is used as a boolean flag to control whether
processes should be forcibly killed. It is only assigned
from boolean expressions and never used in arithmetic or
bitmask operations.

Convert it from int to bool.

No functional change intended.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
Changes in v2:
- Explicitly boolify the MF_MUST_KILL flag test at the kill_procs()
  call site
- Link to v1:https://lore.kernel.org/all/20260407020715.2269255-3-ye.liu@linux.dev/
 mm/memory-failure.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index d25adb390c3e..3babddadff04 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -459,7 +459,7 @@ void add_to_kill_ksm(struct task_struct *tsk, const struct page *p,
  * Only do anything when FORCEKILL is set, otherwise just free the
  * list (this is used for clean pages which do not need killing)
  */
-static void kill_procs(struct list_head *to_kill, int forcekill,
+static void kill_procs(struct list_head *to_kill, bool forcekill,
 		unsigned long pfn, int flags)
 {
 	struct to_kill *tk, *next;
@@ -1582,7 +1582,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
 {
 	LIST_HEAD(tokill);
 	bool unmap_success;
-	int forcekill;
+	bool forcekill;
 	bool mlocked = folio_test_mlocked(folio);
 
 	/*
@@ -1703,7 +1703,7 @@ static void unmap_and_kill(struct list_head *to_kill, unsigned long pfn,
 		unmap_mapping_range(mapping, start, size, 0);
 	}
 
-	kill_procs(to_kill, flags & MF_MUST_KILL, pfn, flags);
+	kill_procs(to_kill, !!(flags & MF_MUST_KILL), pfn, flags);
 }
 
 /*
-- 
2.43.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-10  7:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-10  7:47 [PATCH v2] mm/memory-failure: use bool for forcekill state Ye Liu

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