[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251208130525.2775885-1-pengcan@kylinos.cn>
Date: Mon, 8 Dec 2025 21:05:25 +0800
From: Can Peng <pengcan@...inos.cn>
To: jason.wessel@...driver.com,
danielt@...nel.org,
dianders@...omium.org,
arnd@...db.de,
gregkh@...uxfoundation.org
Cc: kgdb-bugreport@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Can Peng <pengcan@...inos.cn>
Subject: [PATCH] kgdbts: mark kgdbts_option_setup() with __init to free init memory
The kgdbts_option_setup() function is invoked only once early in boot
via the __setup("kgdbts=", ...) mechanism to parse the kernel
command-line option.After init is complete, it is never called again.
Annotating it with __init places the function in the .init.text section,
enabling the kernel to free its code memory during the init memory
cleanup phase (free_initmem()). This reduces the kernel’s runtime
memory footprint with no functional side effects.
Signed-off-by: Can Peng <pengcan@...inos.cn>
---
drivers/misc/kgdbts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 0cf31164b470..4a7022e263ed 100644
--- a/drivers/misc/kgdbts.c
+++ b/drivers/misc/kgdbts.c
@@ -1066,7 +1066,7 @@ static void kgdbts_run_tests(void)
configured = 0;
}
-static int kgdbts_option_setup(char *opt)
+static int __init kgdbts_option_setup(char *opt)
{
if (strlen(opt) >= MAX_CONFIG_LEN) {
printk(KERN_ERR "kgdbts: config string too long\n");
--
2.25.1
Powered by blists - more mailing lists