Skip to content

Commit 4a3cfec

Browse files
visitorckwakpm00
authored andcommitted
alloc_tag: use str_on_off() helper
Replace the ternary (enable ? "on" : "off") with the str_on_off() helper from string_choices.h. This improves readability by replacing the three-operand ternary with a single function call, ensures consistent string output, and allows potential string deduplication by the linker, resulting in a slightly smaller binary. Link: https://lkml.kernel.org/r/20250814093827.237980-1-visitorckw@gmail.com Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw> Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 722d183 commit 4a3cfec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/alloc_tag.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/proc_fs.h>
1010
#include <linux/seq_buf.h>
1111
#include <linux/seq_file.h>
12+
#include <linux/string_choices.h>
1213
#include <linux/vmalloc.h>
1314
#include <linux/kmemleak.h>
1415

@@ -726,7 +727,7 @@ static int __init setup_early_mem_profiling(char *str)
726727
}
727728
mem_profiling_support = true;
728729
pr_info("Memory allocation profiling is enabled %s compression and is turned %s!\n",
729-
compressed ? "with" : "without", enable ? "on" : "off");
730+
compressed ? "with" : "without", str_on_off(enable));
730731
}
731732

732733
if (enable != mem_alloc_profiling_enabled()) {

0 commit comments

Comments
 (0)