From: Liya Huang <1425075683@qq.com>
To: linux-kernel@vger.kernel.org
Cc: Liya Huang <1425075683@qq.com>
Subject: [PATCH] posix-timers: omit posix_cpu_timers_init_group when CONFIG_POSIX_TIMERS is disabled
Date: Sat, 07 Jun 2025 19:41:58 +0800 [thread overview]
Message-ID: <tencent_92F5880EDEB07D078301A561B64F06F9AC0A@qq.com> (raw)
When POSIX timers are disabled (CONFIG_POSIX_TIMERS=n), the helper
function posix_cpu_timers_init_group() is effectively a no-op—but it
still consumes valuable code space. To avoid generating an empty stub,
we should conditionally compile this function out entirely when POSIX
timers support is turned off.
This logic was originally introduced in commit b18b6a9cef7f ("timers:
Omit POSIX timer stuff from task_struct when disabled"), but was
dropped in commit 244d49e30653 ("posix-cpu-timers: Move state tracking
to struct posix_cputimers")
---
Signed-off-by: Liya Huang <1425075683@qq.com>
---
kernel/fork.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/fork.c b/kernel/fork.c
index 168681fc4b25a9fddcb90ce155c027551455f4ee..9632e863c17b44424fadc40b2445034ec5cd20d6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1883,6 +1883,7 @@ void __cleanup_sighand(struct sighand_struct *sighand)
}
}
+#ifdef CONFIG_POSIX_TIMERS
/*
* Initialize POSIX timer handling for a thread group.
*/
@@ -1894,6 +1895,9 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
posix_cputimers_group_init(pct, cpu_limit);
}
+#else
+static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { }
+#endif
static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
{
---
base-commit: 0ff41df1cb268fc69e703a08a57ee14ae967d0ca
change-id: 20250607-posix_cpu_timers_init_group-0439fe81f23a
Best regards,
--
Liya Huang <1425075683@qq.com>
next reply other threads:[~2025-06-07 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-07 11:41 Liya Huang [this message]
2025-06-12 13:22 ` 1425075683
2025-06-13 16:53 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_92F5880EDEB07D078301A561B64F06F9AC0A@qq.com \
--to=1425075683@qq.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®