Skip to contentSkip to conversation

mm/memory-failure: use bool for forcekill state

PATCH Applied Ye Liu 3 participants 3 messages Apr 10 – Apr 13

Subsystems (2)
lore
Share & tools
lore

Ye Liu

author
#0 lore raw

PATCH v2 1/1 mm/memory-failure: use bool for forcekill state

From: Ye Liu <[email protected]>

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

---
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/[email protected]/

 mm/memory-failure.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
mm/memory-failure.c +3 -3
index d25adb390c3e..3babddadff04 100644
@@ -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);
 }
 
 /*
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · On Fri, 10 Apr 2026 15:47:39 +0800 Ye Liu <[email protected]> wrote:

From: Ye Liu <[email protected]>

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

Quoted 5 lines

Convert it from int to bool.

No functional change intended.

Thanks,
SJ

[...]

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Ye Liu
Quoted 7 lines · Ye Liu

From: Ye Liu <[email protected]>

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

Quoted 5 lines

Convert it from int to bool.

No functional change intended.

Thanks.
.