All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Why built-in modules slow down kernel boot?
Date: Tue, 30 Sep 2014 11:28:05 -0700	[thread overview]
Message-ID: <20140930182805.GA25211@kroah.com> (raw)
In-Reply-To: <20140930102712.GA15300@powerline.azcom-win.it>

On Tue, Sep 30, 2014 at 12:27:12PM +0200, Michele Curti wrote:
> Hi all,
> it's just a curiosity. 
> 
> Since the use of an initramfs doubles the kernel boot time I decided to play a
> little compiling as built-in the modules required to mount root (starting 
> from a localmodconfig).
> 
> Everything ok, the system starts and the kernel boot time is good 
> 	Startup finished in 1.749s (firmware) + 375ms (loader) + 
> 	1.402s (kernel) + 716ms (userspace) = 4.244s
> (from systemd-analyze). 
> 
> My next idea was: "Well, why not to make all modules as built-in? So I avoid 
> reading from disk at every module load.. and all of them are loaded 
> anyway", but the results was opposite to my expectations, kernel boot time 
> increased from 1.4 to 3 seconds. 
> 
> So my question is, how this can be explained? 
> 
> My theory is that by compiling all the modules as built-in, the kernel calls
> all the module __init functions in a sequential manner, (using a single 
> core?) and lets the userspace start only when everything is done.

Yes, that is correct.  And some of those init functions do lots of "odd"
things, thinking that the hardware for those drivers really is present,
so they can take a while to figure out that they shouldn't be running at
all.

Also, a larger kernel takes longer to read off of the disk and load into
memory, although with a ssd, it shouldn't be noticable.

greg k-h

      reply	other threads:[~2014-09-30 18:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 10:27 Why built-in modules slow down kernel boot? Michele Curti
2014-09-30 18:28 ` Greg KH [this message]

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=20140930182805.GA25211@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.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.