From: Tejun Heo <tj@kernel.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Jens Axboe <axboe@kernel.dk>, "Rafael J. Wysocki" <rjw@sisk.pl>,
Linux-pm mailing list <linux-pm@vger.kernel.org>,
Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: Bug in disk event polling
Date: Mon, 13 Feb 2012 09:30:27 -0800 [thread overview]
Message-ID: <20120213173027.GC12117@google.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1202121216060.18114-100000@netrider.rowland.org>
Hello, Alan.
On Sun, Feb 12, 2012 at 12:48:22PM -0500, Alan Stern wrote:
> > I think it would be better to use wq for most kthreads. A lot of them
> > aren't strictly correct in the way they deal with
> > kthread_should_stop() and freezing. kthread in general simply seems
> > way too difficult to use correctly.
>
> Maybe so, but getting rid of it at this point would be a big change.
Ooh, yeah, if we do it, it would be a gradual transition.
> Also, kthreads were originally considered more suitable for tasks that
> would need to run for a long time; is this no longer true?
wq no longer has problem w/ long running work items. The only
limiting parameter is max_active, which is primarily there to protect
against berserk cases.
> > > kthread_run() can be adjusted on a case-by-case basis, by inserting
> > > calls to set_freezable() and try_to_freeze() at the appropriate places.
> > > But what about async_schedule()?
> >
> > Given the stuff async is used for, maybe just make all async execution
> > freezable?
>
> That probably won't work. What if a driver relies on async thread
> execution to carry out its I/O?
>
> As another example, sd_probe() calls async_schedule(sd_probe_async,...)
> to handle the long-running parts of probing a SCSI disk. In turn,
> sd_remove() calls async_synchronize_full() to insure that probing is
> over before the device is unbound from sd.
>
> What happens if a hot-unpluggable disk drive is unplugged while the
> system is asleep? It's entirely possible that the bus subsystem's
> resume routine would see the device was gone and would try to
> unregister it. Then sd_remove would wait for the async thread
> to finish, which would never happen because the thread would be frozen
> and wouldn't be thawed until all the resume routines had finished.
>
> In this case, the proper solution is to have the SCSI prepare method
> call async_synchronize_full(). Other cases will require other
> solutions.
Hmmm.... I don't know then. :)
Thanks.
--
tejun
prev parent reply other threads:[~2012-02-13 17:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 20:31 Alan Stern
2012-02-10 20:46 ` Tejun Heo
2012-02-10 21:03 ` Alan Stern
2012-02-10 21:12 ` Tejun Heo
2012-02-10 21:44 ` Alan Stern
2012-02-11 0:23 ` Tejun Heo
2012-02-12 17:48 ` Alan Stern
2012-02-12 21:26 ` Rafael J. Wysocki
2012-02-12 22:02 ` Alan Stern
2012-02-13 17:30 ` Tejun Heo [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=20120213173027.GC12117@google.com \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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
Powered by JetHome