Re: [PATCH 04/16] freezer: implement and usekthread_freezable_should_stop()

From: Henrique de Moraes Holschuh
Date: Fri Aug 19 2011 - 16:09:56 EST


On Fri, 19 Aug 2011, Tejun Heo wrote:
> Writeback and thinkpad_acpi have been using thaw_process() to prevent
> deadlock between the freezer and kthread_stop(); unfortunately, this
> is inherently racy - nothing prevents freezing from happening between
> thaw_process() and kthread_stop().
>
> This patch implements kthread_freezable_should_stop() which enters
> refrigerator if necessary but is guaranteed to return if
> kthread_stop() is invoked. Both thaw_process() users are converted to
> use the new function.
>
> Note that this deadlock condition exists for many of freezable
> kthreads. They need to be converted to use the new should_stop or
> freezable workqueue.
>
> Tested with synthetic test case.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: Henrique de Moraes Holschuh <ibm-acpi@xxxxxxxxxx>

For the thinkpad-acpi bits:
Acked-by: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx>

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/