All of lore.kernel.org
 help / color / mirror / Atom feed
* [merged mm-stable] mm-mm_init-replace-simple_strtoul-with-kstrtobool-in-set_hashdist.patch removed from -mm tree
@ 2026-01-21  3:28 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-01-21  3:28 UTC (permalink / raw)
  To: mm-commits, willy, rppt, thorsten.blum, akpm


The quilt patch titled
     Subject: mm/mm_init: replace simple_strtoul with kstrtobool in set_hashdist
has been removed from the -mm tree.  Its filename was
     mm-mm_init-replace-simple_strtoul-with-kstrtobool-in-set_hashdist.patch

This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Thorsten Blum <thorsten.blum@linux.dev>
Subject: mm/mm_init: replace simple_strtoul with kstrtobool in set_hashdist
Date: Wed, 17 Dec 2025 12:02:13 +0100

Use bool for 'hashdist' and replace simple_strtoul() with kstrtobool() for
parsing the 'hashdist=' boot parameter.  Unlike simple_strtoul(), which
returns an unsigned long, kstrtobool() converts the string directly to
bool and avoids implicit casting.

Check the return value of kstrtobool() and reject invalid values.  This
adds error handling while preserving behavior for existing values, and
removes use of the deprecated simple_strtoul() helper.  The current code
silently sets 'hashdist = 0' if parsing fails, instead of leaving the
default value (HASHDIST_DEFAULT) unchanged.

Additionally, kstrtobool() accepts common boolean strings such as "on" and
"off".

Link: https://lkml.kernel.org/r/20251217110214.50807-1-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/memblock.h |    4 ++--
 mm/mm_init.c             |    9 +++------
 2 files changed, 5 insertions(+), 8 deletions(-)

--- a/include/linux/memblock.h~mm-mm_init-replace-simple_strtoul-with-kstrtobool-in-set_hashdist
+++ a/include/linux/memblock.h
@@ -598,9 +598,9 @@ extern void *alloc_large_system_hash(con
  */
 #ifdef CONFIG_NUMA
 #define HASHDIST_DEFAULT IS_ENABLED(CONFIG_64BIT)
-extern int hashdist;		/* Distribute hashes across NUMA nodes? */
+extern bool hashdist;		/* Distribute hashes across NUMA nodes? */
 #else
-#define hashdist (0)
+#define hashdist (false)
 #endif
 
 #ifdef CONFIG_MEMTEST
--- a/mm/mm_init.c~mm-mm_init-replace-simple_strtoul-with-kstrtobool-in-set_hashdist
+++ a/mm/mm_init.c
@@ -646,21 +646,18 @@ int __meminit early_pfn_to_nid(unsigned
 	return nid;
 }
 
-int hashdist = HASHDIST_DEFAULT;
+bool hashdist = HASHDIST_DEFAULT;
 
 static int __init set_hashdist(char *str)
 {
-	if (!str)
-		return 0;
-	hashdist = simple_strtoul(str, &str, 0);
-	return 1;
+	return kstrtobool(str, &hashdist) == 0;
 }
 __setup("hashdist=", set_hashdist);
 
 static inline void fixup_hashdist(void)
 {
 	if (num_node_state(N_MEMORY) == 1)
-		hashdist = 0;
+		hashdist = false;
 }
 #else
 static inline void fixup_hashdist(void) {}
_

Patches currently in -mm which might be from thorsten.blum@linux.dev are



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

only message in thread, other threads:[~2026-01-21  3:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21  3:28 [merged mm-stable] mm-mm_init-replace-simple_strtoul-with-kstrtobool-in-set_hashdist.patch removed from -mm tree Andrew Morton

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.