]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kgdbts: mark kgdbts_option_setup() with __init to free init memory
authorCan Peng <pengcan@kylinos.cn>
Mon, 8 Dec 2025 13:05:25 +0000 (21:05 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2026 15:35:34 +0000 (16:35 +0100)
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@kylinos.cn>
Link: https://patch.msgid.link/20251208130525.2775885-1-pengcan@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/kgdbts.c

index 0cf31164b4706e332199c95ab467d0cb6d63bf9b..4a7022e263ed18e88f9d1d1df3dd3d3caab6021c 100644 (file)
@@ -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");