Skip to contentSkip to conversation

mm: page_owner: use kstrtobool() to parse bool option

PATCH Applied Sergei Trofimovich 2 participants 2 messages Apr 1, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: page_owner: use kstrtobool() to parse bool option

I tried to use page_owner=1 for a while noticed too late it had no effect as opposed to similar init_on_alloc=1 (these work).

Let's make them consistent.

The change decreses binary size slightly:
text data bss dec hex filename

  12408     321      17   12746    31ca mm/page_owner.o.before
  12320     321      17   12658    3172 mm/page_owner.o.after
---
 mm/page_owner.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
mm/page_owner.c +1 -7
index d15c7c4994f5..63e4ecaba97b 100644
@@ -41,13 +41,7 @@ static void init_early_allocated_pages(void);
 
 static int __init early_page_owner_param(char *buf)
 {
-	if (!buf)
-		return -EINVAL;
-
-	if (strcmp(buf, "on") == 0)
-		page_owner_enabled = true;
-
-	return 0;
+	return kstrtobool(buf, &page_owner_enabled);
 }
 early_param("page_owner", early_page_owner_param);
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Sergei Trofimovich

I tried to use page_owner=1 for a while noticed too late it had no effect as opposed to similar init_on_alloc=1 (these work).

Let's make them consistent.

Quoted 8 lines

The change decreses binary size slightly:
text data bss dec hex filename

  12408     321      17   12746    31ca mm/page_owner.o.before
  12320     321      17   12658    3172 mm/page_owner.o.after

Seems to me there are a few other places that could benefit from this.

kmemleak_boot_config()
early_kasan_flag()
early_kasan_flag_stacktrace()
nonx32_setup()

maybe others? grep is our friend.