| From 401b933116a892dc8fe3e39ae7c1aec7ea94b628 Mon Sep 17 00:00:00 2001 |
| From: Tejun Heo <tj@kernel.org> |
| Date: Mon, 21 Nov 2011 12:32:22 -0800 |
| Subject: freezer: don't unnecessarily set PF_NOFREEZE explicitly |
| |
| Some drivers set PF_NOFREEZE in their kthread functions which is |
| completely unnecessary and racy - some part of freezer code doesn't |
| consider cases where PF_NOFREEZE is set asynchronous to freezer |
| operations. |
| |
| In general, there's no reason to allow setting PF_NOFREEZE explicitly. |
| Remove them and change the documentation to note that setting |
| PF_NOFREEZE directly isn't allowed. |
| |
| -v2: Dropped change to twl4030-irq.c as it no longer uses PF_NOFREEZE. |
| |
| Signed-off-by: Tejun Heo <tj@kernel.org> |
| Acked-by: "Gustavo F. Padovan" <padovan@profusion.mobi> |
| Acked-by: Samuel Ortiz <sameo@linux.intel.com> |
| Cc: Marcel Holtmann <marcel@holtmann.org> |
| Cc: wwang <wei_wang@realsil.com.cn> |
| (cherry picked from commit 3a7cbd50f74907580eb47a8d08e1f29741b81abf) |
| |
| Signed-off-by: Simon Horman <horms@verge.net.au> |
| --- |
| Documentation/power/freezing-of-tasks.txt | 2 +- |
| drivers/bluetooth/btmrvl_main.c | 2 -- |
| drivers/mfd/twl6030-irq.c | 2 -- |
| drivers/staging/rts_pstor/rtsx.c | 2 -- |
| 4 files changed, 1 insertion(+), 7 deletions(-) |
| |
| diff --git a/Documentation/power/freezing-of-tasks.txt b/Documentation/power/freezing-of-tasks.txt |
| index 316c2ba..587e082 100644 |
| --- a/Documentation/power/freezing-of-tasks.txt |
| +++ b/Documentation/power/freezing-of-tasks.txt |
| @@ -67,7 +67,7 @@ III. Which kernel threads are freezable? |
| |
| Kernel threads are not freezable by default. However, a kernel thread may clear |
| PF_NOFREEZE for itself by calling set_freezable() (the resetting of PF_NOFREEZE |
| -directly is strongly discouraged). From this point it is regarded as freezable |
| +directly is not allowed). From this point it is regarded as freezable |
| and must call try_to_freeze() in a suitable place. |
| |
| IV. Why do we do that? |
| diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c |
| index 548d1d9..57312d4 100644 |
| --- a/drivers/bluetooth/btmrvl_main.c |
| +++ b/drivers/bluetooth/btmrvl_main.c |
| @@ -473,8 +473,6 @@ static int btmrvl_service_main_thread(void *data) |
| |
| init_waitqueue_entry(&wait, current); |
| |
| - current->flags |= PF_NOFREEZE; |
| - |
| for (;;) { |
| add_wait_queue(&thread->wait_q, &wait); |
| |
| diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c |
| index b0563b6..71990f9 100644 |
| --- a/drivers/mfd/twl6030-irq.c |
| +++ b/drivers/mfd/twl6030-irq.c |
| @@ -96,8 +96,6 @@ static int twl6030_irq_thread(void *data) |
| static const unsigned max_i2c_errors = 100; |
| int ret; |
| |
| - current->flags |= PF_NOFREEZE; |
| - |
| while (!kthread_should_stop()) { |
| int i; |
| union { |
| diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c |
| index 5ff59f2..2f35832 100644 |
| --- a/drivers/staging/rts_pstor/rtsx.c |
| +++ b/drivers/staging/rts_pstor/rtsx.c |
| @@ -472,8 +472,6 @@ static int rtsx_control_thread(void *__dev) |
| struct rtsx_chip *chip = dev->chip; |
| struct Scsi_Host *host = rtsx_to_host(dev); |
| |
| - current->flags |= PF_NOFREEZE; |
| - |
| for (;;) { |
| if (down_interruptible(&dev->sema)) |
| break; |
| -- |
| 1.7.10.1.362.g242cab3 |
| |