* [PATCH] Convert refrigerator() to try_to_freeze()
@ 2005-07-18 3:59 Nigel Cunningham
2005-07-19 13:54 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Nigel Cunningham @ 2005-07-18 3:59 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel Mailing List
Hi.
This patch removes the few remaining direct invocations of the
refrigerator in 2.6.13-rc3. In drivers/media/video/msp3400.c, it also
shifts the call to after the remove_wait_queue; this seems to be the
more appropriate place.
Regards,
Nigel
Signed-off by: Nigel Cunningham <nigel@suspend2.net>
drivers/media/video/msp3400.c | 4 +---
drivers/net/irda/stir4200.c | 2 +-
fs/jbd/journal.c | 2 +-
fs/jfs/jfs_logmgr.c | 2 +-
fs/jfs/jfs_txnmgr.c | 4 ++--
fs/xfs/linux-2.6/xfs_buf.c | 2 +-
6 files changed, 7 insertions(+), 9 deletions(-)
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/drivers/media/video/msp3400.c 230-refrigerator-to-try_to_freeze.patch-new/drivers/media/video/msp3400.c
--- 230-refrigerator-to-try_to_freeze.patch-old/drivers/media/video/msp3400.c 2005-07-18 06:36:48.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/drivers/media/video/msp3400.c 2005-07-18 13:54:48.000000000 +1000
@@ -741,11 +741,9 @@ static int msp34xx_sleep(struct msp3400c
schedule_timeout(msecs_to_jiffies(timeout));
}
}
- if (current->flags & PF_FREEZE) {
- refrigerator ();
- }
remove_wait_queue(&msp->wq, &wait);
+ try_to_freeze();
return msp->restart;
}
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/drivers/net/irda/stir4200.c 230-refrigerator-to-try_to_freeze.patch-new/drivers/net/irda/stir4200.c
--- 230-refrigerator-to-try_to_freeze.patch-old/drivers/net/irda/stir4200.c 2005-07-18 06:36:51.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/drivers/net/irda/stir4200.c 2005-07-18 08:20:58.000000000 +1000
@@ -771,7 +771,7 @@ static int stir_transmit_thread(void *ar
write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
- refrigerator();
+ try_to_freeze();
if (change_speed(stir, stir->speed))
break;
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c
--- 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 2005-07-18 06:36:59.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c 2005-07-18 13:54:47.000000000 +1000
@@ -175,7 +175,7 @@ loop:
*/
jbd_debug(1, "Now suspending kjournald\n");
spin_unlock(&journal->j_state_lock);
- refrigerator();
+ try_to_freeze();
spin_lock(&journal->j_state_lock);
} else {
/*
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c
--- 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 2005-07-18 06:36:59.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c 2005-07-18 13:54:47.000000000 +1000
@@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg)
}
if (freezing(current)) {
spin_unlock_irq(&log_redrive_lock);
- refrigerator();
+ try_to_freeze();
} else {
add_wait_queue(&jfs_IO_thread_wait, &wq);
set_current_state(TASK_INTERRUPTIBLE);
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_txnmgr.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_txnmgr.c
--- 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_txnmgr.c 2005-07-18 06:36:59.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_txnmgr.c 2005-07-18 13:54:47.000000000 +1000
@@ -2790,7 +2790,7 @@ int jfs_lazycommit(void *arg)
if (freezing(current)) {
LAZY_UNLOCK(flags);
- refrigerator();
+ try_to_freeze();
} else {
DECLARE_WAITQUEUE(wq, current);
@@ -2989,7 +2989,7 @@ int jfs_sync(void *arg)
if (freezing(current)) {
TXN_UNLOCK();
- refrigerator();
+ try_to_freeze();
} else {
DECLARE_WAITQUEUE(wq, current);
diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/xfs/linux-2.6/xfs_buf.c 230-refrigerator-to-try_to_freeze.patch-new/fs/xfs/linux-2.6/xfs_buf.c
--- 230-refrigerator-to-try_to_freeze.patch-old/fs/xfs/linux-2.6/xfs_buf.c 2005-07-18 06:37:01.000000000 +1000
+++ 230-refrigerator-to-try_to_freeze.patch-new/fs/xfs/linux-2.6/xfs_buf.c 2005-07-18 13:54:48.000000000 +1000
@@ -1773,7 +1773,7 @@ xfsbufd(
do {
if (unlikely(freezing(current))) {
xfsbufd_force_sleep = 1;
- refrigerator();
+ try_to_freeze();
} else {
xfsbufd_force_sleep = 0;
}
--
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.
Be amazed that people believe it happened.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Convert refrigerator() to try_to_freeze()
2005-07-18 3:59 [PATCH] Convert refrigerator() to try_to_freeze() Nigel Cunningham
@ 2005-07-19 13:54 ` Pavel Machek
2005-07-20 2:31 ` Nigel Cunningham
2005-07-21 4:48 ` Nigel Cunningham
0 siblings, 2 replies; 4+ messages in thread
From: Pavel Machek @ 2005-07-19 13:54 UTC (permalink / raw)
To: Nigel Cunningham; +Cc: Andrew Morton, Linux Kernel Mailing List
Hi!
> This patch removes the few remaining direct invocations of the
> refrigerator in 2.6.13-rc3. In drivers/media/video/msp3400.c, it also
> shifts the call to after the remove_wait_queue; this seems to be the
> more appropriate place.
> diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c
> --- 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 2005-07-18 06:36:59.000000000 +1000
> +++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c 2005-07-18 13:54:47.000000000 +1000
> @@ -175,7 +175,7 @@ loop:
> */
> jbd_debug(1, "Now suspending kjournald\n");
> spin_unlock(&journal->j_state_lock);
> - refrigerator();
> + try_to_freeze();
> spin_lock(&journal->j_state_lock);
> } else {
> /*
They probably tested it before, why test again?
> diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c
> --- 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 2005-07-18 06:36:59.000000000 +1000
> +++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c 2005-07-18 13:54:47.000000000 +1000
> @@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg)
> }
> if (freezing(current)) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> spin_unlock_irq(&log_redrive_lock);
> - refrigerator();
> + try_to_freeze();
> } else {
> add_wait_queue(&jfs_IO_thread_wait, &wq);
> set_current_state(TASK_INTERRUPTIBLE);
See? You are needlessly testing condition twice.
Pavel
--
teflon -- maybe it is a trademark, but it should not be.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Convert refrigerator() to try_to_freeze()
2005-07-19 13:54 ` Pavel Machek
@ 2005-07-20 2:31 ` Nigel Cunningham
2005-07-21 4:48 ` Nigel Cunningham
1 sibling, 0 replies; 4+ messages in thread
From: Nigel Cunningham @ 2005-07-20 2:31 UTC (permalink / raw)
To: Pavel Machek; +Cc: Andrew Morton, Linux Kernel Mailing List
Hi.
On Tue, 2005-07-19 at 23:54, Pavel Machek wrote:
> Hi!
>
> > This patch removes the few remaining direct invocations of the
> > refrigerator in 2.6.13-rc3. In drivers/media/video/msp3400.c, it also
> > shifts the call to after the remove_wait_queue; this seems to be the
> > more appropriate place.
>
>
> > diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c
> > --- 230-refrigerator-to-try_to_freeze.patch-old/fs/jbd/journal.c 2005-07-18 06:36:59.000000000 +1000
> > +++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jbd/journal.c 2005-07-18 13:54:47.000000000 +1000
> > @@ -175,7 +175,7 @@ loop:
> > */
> > jbd_debug(1, "Now suspending kjournald\n");
> > spin_unlock(&journal->j_state_lock);
> > - refrigerator();
> > + try_to_freeze();
> > spin_lock(&journal->j_state_lock);
> > } else {
> > /*
>
> They probably tested it before, why test again?
>
> > diff -ruNp 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c
> > --- 230-refrigerator-to-try_to_freeze.patch-old/fs/jfs/jfs_logmgr.c 2005-07-18 06:36:59.000000000 +1000
> > +++ 230-refrigerator-to-try_to_freeze.patch-new/fs/jfs/jfs_logmgr.c 2005-07-18 13:54:47.000000000 +1000
> > @@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg)
> > }
> > if (freezing(current)) {
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > spin_unlock_irq(&log_redrive_lock);
> > - refrigerator();
> > + try_to_freeze();
> > } else {
> > add_wait_queue(&jfs_IO_thread_wait, &wq);
> > set_current_state(TASK_INTERRUPTIBLE);
>
> See? You are needlessly testing condition twice.
True. I was just concerned that things are messy and inconsistent as
they stand (sometimes we use try_to_freeze and implicitly call
refrigerator(), sometimes we call freezing() and refrigerator). *shrug*
Regards,
Nigel
--
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Convert refrigerator() to try_to_freeze()
2005-07-19 13:54 ` Pavel Machek
2005-07-20 2:31 ` Nigel Cunningham
@ 2005-07-21 4:48 ` Nigel Cunningham
1 sibling, 0 replies; 4+ messages in thread
From: Nigel Cunningham @ 2005-07-21 4:48 UTC (permalink / raw)
To: Pavel Machek; +Cc: Andrew Morton, Linux Kernel Mailing List
Hi.
On the testing twice, fair enough. I'll send a new version with the
refrigerator changes, as jbd won't need that dirty big if..else then
since there's no danger of a deadlock.
Regards,
Nigel
--
Evolution.
Enumerate the requirements.
Consider the interdependencies.
Calculate the probabilities.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-07-21 4:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18 3:59 [PATCH] Convert refrigerator() to try_to_freeze() Nigel Cunningham
2005-07-19 13:54 ` Pavel Machek
2005-07-20 2:31 ` Nigel Cunningham
2005-07-21 4:48 ` Nigel Cunningham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox