From: Jeff Garzik <jgarzik@pobox.com>
To: Andrew Morton <akpm@osdl.org>
Cc: ranty@debian.org, linux-kernel@vger.kernel.org, willy@debian.org
Subject: Re: [PATCH] [2.6.0-test3] request_firmware related problems.
Date: Sun, 10 Aug 2003 18:56:19 -0400 [thread overview]
Message-ID: <3F36CD93.4010704@pobox.com> (raw)
In-Reply-To: <20030810142928.4b734e8d.akpm@osdl.org>
Andrew Morton wrote:
> Does this mean that we have another gaggle of kernel threads for all the
> time the system is up?
>
> It might be better to create a custom kernel thread on-demand, or kill off
> the workqueue when its job has completed.
Thanks for mentioning this!
There is indeed an explosion of kernel threads. I feel many of them
fall into two categories:
* needs a one-shot kernel thread, often after a timer fires or similar
interrupt-ish-context code runs (error handling threads also apply here)
* only needs per-cpu threads if IO(or net) load is significant
And personally, I don't think anyone would scream if
schedule_{task,work} just created a new thread -- if needed -- and then
did the work. That's what the driver authors _really_ want out of the
interface, IMO. They don't want to wait for another keventd task,
typically. In other words, a thread pool, that will create new threads
beyond the max pool size.
On the other side of the coin, a valid reason for creating kernel
threads is when your application is constantly doing stuff in process
context. You might as well have dedicated kernel threads for these
drivers, because you are assured you will need at least one.
So, in terms of concrete suggestions:
1) if schedule_work is called and no kevent thread is available, create
a new one
2) ponder perhaps an implementation that would use generic keventd until
a certain load is reached; then, create per-cpu kernel threads just like
private workqueue creation occurs now. i.e. switch from shared
(keventd) to private at runtime.
As a tangent, I would love a simplified interface that was used in
driver code like this:
run_in_process_context(callback_fn, callback_data)
that eliminates the tq/workqueue struct altogether. Combine this
simplified interface with suggestion #1 above, and you've got something
quite useful, and tough to screw up.
Jeff
next prev parent reply other threads:[~2003-08-10 22:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-10 21:06 [PATCH] [2.6.0-test3] request_firmware related problems Manuel Estrada Sainz
2003-08-10 21:29 ` Andrew Morton
2003-08-10 21:59 ` Manuel Estrada Sainz
2003-08-10 22:56 ` Jeff Garzik [this message]
2003-08-10 23:00 ` Jeff Garzik
2003-08-12 1:25 ` Handling workqueue threads (was: Re: [PATCH] [2.6.0-test3] request_firmware related problems.) Manuel Estrada Sainz
2003-08-12 15:21 ` [PATCH] [2.6.0-test3] request_firmware related problems Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2003-08-10 22:15 Manuel Estrada Sainz
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=3F36CD93.4010704@pobox.com \
--to=jgarzik@pobox.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ranty@debian.org \
--cc=willy@debian.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