From: "Luis R. Rodriguez" <mcgrof@kernel.org>
To: jeyu@kernel.org, rusty@rustcorp.com.au
Cc: keescook@chromium.org, tixxdz@gmail.com, mbenes@suse.cz,
atomlin@redhat.com, pmladek@suse.com, hare@suse.com,
james.l.morris@oracle.com, ebiederm@xmission.com,
davem@davemloft.net, akpm@linux-foundation.org,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
"Luis R. Rodriguez" <mcgrof@kernel.org>
Subject: [PATCH 2/3] module: move finished_loading()
Date: Thu, 7 Dec 2017 16:15:39 -0800 [thread overview]
Message-ID: <20171208001540.23696-3-mcgrof@kernel.org> (raw)
In-Reply-To: <20171208001540.23696-1-mcgrof@kernel.org>
This has no functional change, just moves a routine earlier
as we'll make use of it next.
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
kernel/module.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 195ef37e242a..fb2afcde5d20 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3287,6 +3287,27 @@ static bool blacklisted(const char *module_name)
}
core_param(module_blacklist, module_blacklist, charp, 0400);
+/* Is this module of this name done loading? No locks held. */
+static bool finished_loading(const char *name)
+{
+ struct module *mod;
+ bool ret;
+
+ /*
+ * The module_mutex should not be a heavily contended lock;
+ * if we get the occasional sleep here, we'll go an extra iteration
+ * in the wait_event_interruptible(), which is harmless.
+ */
+ sched_annotate_sleep();
+ mutex_lock(&module_mutex);
+ mod = find_module_all(name, strlen(name), true);
+ ret = !mod || mod->state == MODULE_STATE_LIVE
+ || mod->state == MODULE_STATE_GOING;
+ mutex_unlock(&module_mutex);
+
+ return ret;
+}
+
/* Module within temporary copy, this doesn't do any allocation */
static int early_mod_check(struct load_info *info, int flags,
struct module *mod)
@@ -3377,27 +3398,6 @@ static int post_relocation(struct module *mod, const struct load_info *info)
return module_finalize(info->hdr, info->sechdrs, mod);
}
-/* Is this module of this name done loading? No locks held. */
-static bool finished_loading(const char *name)
-{
- struct module *mod;
- bool ret;
-
- /*
- * The module_mutex should not be a heavily contended lock;
- * if we get the occasional sleep here, we'll go an extra iteration
- * in the wait_event_interruptible(), which is harmless.
- */
- sched_annotate_sleep();
- mutex_lock(&module_mutex);
- mod = find_module_all(name, strlen(name), true);
- ret = !mod || mod->state == MODULE_STATE_LIVE
- || mod->state == MODULE_STATE_GOING;
- mutex_unlock(&module_mutex);
-
- return ret;
-}
-
/* Call module constructors. */
static void do_mod_ctors(struct module *mod)
{
--
2.15.0
next prev parent reply other threads:[~2017-12-08 0:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 0:15 [PATCH 0/3] module: minor allocation optimization Luis R. Rodriguez
2017-12-08 0:15 ` [PATCH 1/3] module: add an early early_mod_check() Luis R. Rodriguez
2017-12-19 1:00 ` Jessica Yu
2017-12-08 0:15 ` Luis R. Rodriguez [this message]
2017-12-08 0:15 ` [PATCH 3/3] module: avoid allocation if module is already present and ready Luis R. Rodriguez
2017-12-19 1:26 ` Jessica Yu
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=20171208001540.23696-3-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=atomlin@redhat.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=hare@suse.com \
--cc=james.l.morris@oracle.com \
--cc=jeyu@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
--cc=rusty@rustcorp.com.au \
--cc=tixxdz@gmail.com \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).