From: "Jörn Engel" <joern@logfs.org>
To: Tim Bird <tim.bird@am.sony.com>
Cc: linux-embedded <linux-embedded@vger.kernel.org>,
linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Recommendation for activating a deferred module init in the kernel
Date: Tue, 17 Jun 2008 22:19:25 +0200 [thread overview]
Message-ID: <20080617201925.GB31224@logfs.org> (raw)
In-Reply-To: <485815F6.20507@am.sony.com>
On Tue, 17 June 2008 12:52:22 -0700, Tim Bird wrote:
> Jörn Engel wrote:
> > On Tue, 17 June 2008 11:23:18 -0700, Tim Bird wrote:
> >> 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.
> >
> > I personally would be unhappy with any kind of interface for this. It
> > would be much nicer to make it transparent and still get the benefits.
> > One option would be to start a kernel thread for the initialization and
> > renice it to 19 or so.
>
> That's an interesting idea. I'm pretty sure the product guys want
> an explicit trigger, so they can make sure they've got the main
> application well underway before this deferred initialization occurs.
Well, there should be a way to ensure this doesn't hog the cpu at all -
unless it is idle or someone is actually waiting for the initialization
to finish. Not sure if nice 19 is good enough for that.
> > If you want an explicit trigger, you could either hook into init_post()
> > or have hooks in the open functions of drivers with deferred
> > initialization.
>
> This would presumably require multiple calls (one to the open of
> each deferred module). I would still need a trigger for the memory
> free operation, unless I hardcode the order of the opening and just
> "know" that the last one should free the memory. I'll have to see
> if all the modules being loaded like this have open()s.
If you want to keep things simple - and I believe initially you should -
you can simply do all initializations in one go. Something like this:
int foo_open(...)
{
wait_for_deferred_init();
...
}
static DECLARE_COMPLETION(init_complete);
void wait_for_deferred_init(void)
{
static atomic_t in_progress = ATOMIC_INIT(-1);
if (!atomic_inc_not_zero(in_progress) {
wait_for_completion(init_complete);
return;
}
for (all deferred initcalls)
foo_init();
complete(init_complete);
free_memory();
}
Jörn
--
Anything that can go wrong, will.
-- Finagle's Law
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-06-17 20:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20080617201925.GB31224@logfs.org \
--to=joern@logfs.org \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tim.bird@am.sony.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;
as well as URLs for NNTP newsgroup(s).