All of lore.kernel.org
 help / color / mirror / Atom feed
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 0/3] module: minor allocation optimization
Date: Thu,  7 Dec 2017 16:15:37 -0800	[thread overview]
Message-ID: <20171208001540.23696-1-mcgrof@kernel.org> (raw)

Long ago I was debugging kernel/module.c and kernel/kmod.c and had
implemented a sanity check to avoid allocating much of the needed struct
module from what user passes on finit_module() too early, ie, before
checking if the module was actually loaded.

I had disregarded this work as I had bundled it up with some aliasing
work I had done, so incorrectly thought this depended on the alias work.
Upon a second look it does not. The module name set on userspace on
info->name is not the alias but the proper module name, as such using
finished_loading() should suffice once to avoid allocating the module
if its already present.

I've tested this with kmod.sh and found no regressions, the few minor
enhancements are documented in patch 3 in detail. I'll let 0-day hammer
on it as we review the patches [0] [1] but no build issues so far.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=20171207-avoid-bogus-layout_and_allocate
[1] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20171207-avoid-bogus-layout_and_allocate

Luis R. Rodriguez (3):
  module: add an early early_mod_check()
  module: move finished_loading()
  module: avoid allocation if module is already present and ready

 kernel/module.c | 81 ++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 49 insertions(+), 32 deletions(-)

-- 
2.15.0

             reply	other threads:[~2017-12-08  0:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  0:15 Luis R. Rodriguez [this message]
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 ` [PATCH 2/3] module: move finished_loading() Luis R. Rodriguez
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-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.