* [PATCH] alloc_tag: Use str_on_off() helper
@ 2025-08-14 9:38 Kuan-Wei Chiu
0 siblings, 0 replies; only message in thread
From: Kuan-Wei Chiu @ 2025-08-14 9:38 UTC (permalink / raw)
To: surenb, kent.overstreet, akpm
Cc: linux-mm, linux-kernel, jserv, Kuan-Wei Chiu
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.
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
Compiled test only.
lib/alloc_tag.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index e9b33848700a..d4449205eca2 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -9,6 +9,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_buf.h>
#include <linux/seq_file.h>
+#include <linux/string_choices.h>
#include <linux/vmalloc.h>
#include <linux/kmemleak.h>
@@ -726,7 +727,7 @@ static int __init setup_early_mem_profiling(char *str)
}
mem_profiling_support = true;
pr_info("Memory allocation profiling is enabled %s compression and is turned %s!\n",
- compressed ? "with" : "without", enable ? "on" : "off");
+ compressed ? "with" : "without", str_on_off(enable));
}
if (enable != mem_alloc_profiling_enabled()) {
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-14 9:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-14 9:38 [PATCH] alloc_tag: Use str_on_off() helper Kuan-Wei Chiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®