* [PATCH 2/3] bcache: Avoid hung task happen.
@ 2014-01-08 11:39 majianpeng
2014-01-08 21:34 ` Kent Overstreet
0 siblings, 1 reply; 3+ messages in thread
From: majianpeng @ 2014-01-08 11:39 UTC (permalink / raw)
To: kmo; +Cc: linux-bcache
Because after kthread_create, the state of kthread is TASK_UNINTERRUPTIBLE.
If we don't wake up dc->writeback_thread, the thread will be hung-task.
For those reasons, we don't wake up writeback_thread:
A:only create backed device
B:create backed device and cache device, but don't write at once
C:write without writeback poliy
So like the way of create gc_thread, after creating writeback_thread, i
set the state is TASK_INTERRUPTIBLE.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
drivers/md/bcache/writeback.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 6c44fe0..7fbc22a 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -499,6 +499,8 @@ int bch_cached_dev_writeback_init(struct cached_dev *dc)
if (IS_ERR(dc->writeback_thread))
return PTR_ERR(dc->writeback_thread);
+ set_task_state(dc->writeback_thread, TASK_INTERRUPTIBLE);
+
INIT_DELAYED_WORK(&dc->writeback_rate_update, update_writeback_rate);
schedule_delayed_work(&dc->writeback_rate_update,
dc->writeback_rate_update_seconds * HZ);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] bcache: Avoid hung task happen.
2014-01-08 11:39 [PATCH 2/3] bcache: Avoid hung task happen majianpeng
@ 2014-01-08 21:34 ` Kent Overstreet
2014-01-09 3:00 ` majianpeng
0 siblings, 1 reply; 3+ messages in thread
From: Kent Overstreet @ 2014-01-08 21:34 UTC (permalink / raw)
To: majianpeng; +Cc: linux-bcache
On Wed, Jan 08, 2014 at 07:39:26PM +0800, majianpeng wrote:
> Because after kthread_create, the state of kthread is TASK_UNINTERRUPTIBLE.
> If we don't wake up dc->writeback_thread, the thread will be hung-task.
> For those reasons, we don't wake up writeback_thread:
> A:only create backed device
> B:create backed device and cache device, but don't write at once
> C:write without writeback poliy
>
> So like the way of create gc_thread, after creating writeback_thread, i
> set the state is TASK_INTERRUPTIBLE.
I've seen this issue, but this isn't even where the sleep happens,
there's no way this could be fixing it..
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH 2/3] bcache: Avoid hung task happen.
2014-01-08 21:34 ` Kent Overstreet
@ 2014-01-09 3:00 ` majianpeng
0 siblings, 0 replies; 3+ messages in thread
From: majianpeng @ 2014-01-09 3:00 UTC (permalink / raw)
To: kmo; +Cc: linux-bcache
>On Wed, Jan 08, 2014 at 07:39:26PM +0800, majianpeng wrote:
>> Because after kthread_create, the state of kthread is TASK_UNINTERRUPTIBLE.
>> If we don't wake up dc->writeback_thread, the thread will be hung-task.
>> For those reasons, we don't wake up writeback_thread:
>> A:only create backed device
>> B:create backed device and cache device, but don't write at once
>> C:write without writeback poliy
>>
>> So like the way of create gc_thread, after creating writeback_thread, i
>> set the state is TASK_INTERRUPTIBLE.
>
>I've seen this issue, but this isn't even where the sleep happens,
>there's no way this could be fixing it..
Yes.But now, the default cache mode is writethrough.So kernel also printk hung-task messages.
If you don't like this way, you can use kthread_run instead kthread_create.
Because you test dc->has_dirty in bch_writeback_thread,so using kthread_run is safe.
Thanks!
Jianpeng Ma
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-09 3:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-08 11:39 [PATCH 2/3] bcache: Avoid hung task happen majianpeng
2014-01-08 21:34 ` Kent Overstreet
2014-01-09 3:00 ` majianpeng
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).