From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-kernel@vger.kernel.org,
Daniel Jordan <daniel.m.jordan@oracle.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 1/2] padata: Mark remaining code as __init and data as __initdata
Date: Fri, 17 Jul 2026 10:18:30 -0700 [thread overview]
Message-ID: <20260717171831.27994-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20260717171831.27994-1-ebiggers@kernel.org>
Since the serialized job support was removed from padata, the remaining
code is used only by the multithreaded job support, whose public
functions are __init.
Therefore, also mark the internal functions as __init and the internal
data as __initdata.
This makes them be discarded after the kernel boots. It also eliminates
the need to mark padata_work_init() as __ref.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
kernel/padata.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/kernel/padata.c b/kernel/padata.c
index 6eb130d31024..e7f89e3e44e9 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -31,9 +31,9 @@ struct padata_work {
void *pw_data;
};
-static DEFINE_SPINLOCK(padata_works_lock);
-static struct padata_work *padata_works;
-static LIST_HEAD(padata_free_works);
+static __initdata DEFINE_SPINLOCK(padata_works_lock);
+static __initdata struct padata_work *padata_works;
+static __initdata LIST_HEAD(padata_free_works);
struct padata_mt_job_state {
spinlock_t lock;
@@ -46,7 +46,7 @@ struct padata_mt_job_state {
static void __init padata_mt_helper(struct work_struct *work);
-static struct padata_work *padata_work_alloc(void)
+static struct padata_work *__init padata_work_alloc(void)
{
struct padata_work *pw;
@@ -60,16 +60,8 @@ static struct padata_work *padata_work_alloc(void)
return pw;
}
-/*
- * This function is marked __ref because this function may be optimized in such
- * a way that it directly refers to work_fn's address, which causes modpost to
- * complain when work_fn is marked __init. This scenario was observed with clang
- * LTO, where padata_work_init() was optimized to refer directly to
- * padata_mt_helper() because the calls to padata_work_init() with other work_fn
- * values were eliminated or inlined.
- */
-static void __ref padata_work_init(struct padata_work *pw, work_func_t work_fn,
- void *data, int flags)
+static void __init padata_work_init(struct padata_work *pw, work_func_t work_fn,
+ void *data, int flags)
{
if (flags & PADATA_WORK_ONSTACK)
INIT_WORK_ONSTACK(&pw->pw_work, work_fn);
@@ -98,7 +90,7 @@ static int __init padata_work_alloc_mt(int nworks, void *data,
return i;
}
-static void padata_work_free(struct padata_work *pw)
+static void __init padata_work_free(struct padata_work *pw)
{
lockdep_assert_held(&padata_works_lock);
list_add(&pw->pw_list, &padata_free_works);
--
2.55.0
next prev parent reply other threads:[~2026-07-17 17:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 17:18 [PATCH 0/2] More padata cleanups Eric Biggers
2026-07-17 17:18 ` Eric Biggers [this message]
2026-07-17 20:34 ` [PATCH 1/2] padata: Mark remaining code as __init and data as __initdata Daniel Jordan
2026-07-17 17:18 ` [PATCH 2/2] padata: Free the padata_works when they're no longer needed Eric Biggers
2026-07-17 20:35 ` Daniel Jordan
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=20260717171831.27994-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=daniel.m.jordan@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/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