linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Recommendation for activating a deferred module init in the kernel
@ 2008-06-17 18:23 Tim Bird
  2008-06-17 18:51 ` David VomLehn
                   ` (3 more replies)
  0 siblings, 4 replies; 30+ messages in thread
From: Tim Bird @ 2008-06-17 18:23 UTC (permalink / raw)
  To: linux-embedded

Hi all,

I am working with a product team on bootup time issues.  One technique
that we are forward-porting from an old kernel (and that I thought I
might work on mainlining) is to compile modules statically into the kernel,
but defer their initialization until after boot time.

Normally, module init routines are declared with module_init(), which,
when they are statically linked into the kernel, uses the macro
__define_initcall() to add an entry to a special init segment.
This is called during bootup by do_initcall() (in init/main.c),
and the memory where the function resides is eventually freed.

There are several phases of initcalls (see include/linux/init.h),
including core, postcore, arch, subsys, fs, rootfs, device, and late.

In our modification, we:
 1) add another phase for deferred initcalls
 2) modify the module_init macro definition to use that phase, for the
 modules we wish to defer initialization of
 3) modify the free code to not free the memory until later
 4) add an ioctl to trigger the deferred initialization (and memory free)

One of the main sub-systems that we defer initialization of this
way is USB, and this saves quite a bit of time.  (Of course the
same, or slightly more CPU cycles are eventually used during
bootup time.  But this lets us get to user space quicker so we
can start user-visible applications faster.)

I'm not that happy using an ioctl for this trigger.  What is
the preferred method of activating a kernel feature like this?
I presume something in /proc or /sys, but I'm not sure.

Also, is there something like this in the kernel now that I'm
missing?

Any advice or comments would be welcome.

Thanks,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================


^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: Recommendation for activating a deferred module init in the kernel
@ 2008-06-18  6:47 Gilad Ben-Yossef
  2008-06-18  8:20 ` David Woodhouse
  0 siblings, 1 reply; 30+ messages in thread
From: Gilad Ben-Yossef @ 2008-06-18  6:47 UTC (permalink / raw)
  To: Tim Bird; +Cc: linux-embedded

[Resending due to reject from vger mail server. My apologies if you got 
this twice ]


Hi,


Tim Bird wrote:

> I am working with a product team on bootup time issues.  One technique
> that we are forward-porting from an old kernel (and that I thought I
> might work on mainlining) is to compile modules statically into the kernel,
> but defer their initialization until after boot time.
>   
This may sound like a stupid question, but why are you compiling the 
modules statically?

I mean, it sounds to me like the perfect way to do what you want is to 
compile the modules dynamically (you can store them in a an in kernel 
initramfs if you want to keep them attached to the kernel binary for 
ease of maintenance) and simply call a script that calls modprobe when 
it's OK to load them?

Sounds a hell of lot simpler to me...

Gilad

-- 
Gilad Ben-Yossef 
Chief Coffee Drinker

Codefidence Ltd.
The code is free, your time isn't.(TM)

Web:    http://codefidence.com
Email:  gilad@codefidence.com
Office: +972-8-9316883 ext. 201
Fax:    +972-8-9316885
Mobile: +972-52-8260388

	Q: How many NSA agents does it take to replace a lightbulb?
	A: dSva7DrYiY24yeTItKyyogFXD5gRuoRqPNQ9v6WCLLywZPINlu!



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2008-07-01 14:20 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 18:23 Recommendation for activating a deferred module init in the kernel Tim Bird
2008-06-17 18:51 ` David VomLehn
2008-06-17 19:07 ` Jörn Engel
2008-06-17 19:22   ` Jim Freeman
2008-06-17 20:06     ` Tim Bird
2008-06-17 19:52   ` Tim Bird
2008-06-17 19:55     ` Tim Bird
2008-06-17 20:23       ` Jörn Engel
2008-06-17 20:35         ` Josh Boyer
2008-06-17 22:48           ` Stefan Richter
2008-06-18  0:03             ` Johannes Stezenbach
2008-06-18  0:10               ` Stefan Richter
2008-06-18  9:38                 ` Johannes Stezenbach
2008-06-17 20:19     ` Jörn Engel
2008-06-18 12:38 ` Amol Lad
     [not found] ` <4858A659.8030502@codefidence.com>
2008-06-18 16:08   ` Tim Bird
     [not found]     ` <4859ECF3.3000500@codefidence.com>
2008-06-19 17:58       ` Tim Bird
2008-06-22  7:08         ` Gilad Ben-Yossef
2008-06-23 17:40           ` Tim Bird
2008-07-01 14:20             ` Gilad Ben-Yossef
  -- strict thread matches above, loose matches on Subject: below --
2008-06-18  6:47 Gilad Ben-Yossef
2008-06-18  8:20 ` David Woodhouse
2008-06-18  8:32   ` David Woodhouse
2008-06-18  8:52   ` Adrian Bunk
2008-06-18  8:57     ` Geert Uytterhoeven
2008-06-18  9:59       ` David Woodhouse
2008-06-18 10:33         ` Adrian Bunk
2008-06-18 10:41           ` David Woodhouse
2008-06-18 11:37           ` Geert Uytterhoeven
2008-06-18 14:56             ` Nicolas Pitre

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).