JFFS2 garbage collection threads not freezing?
We've ported from 2.6.18 to 2.6.24-rc3 on a pxa270-based machine and can no longer enter 'standby' or 'mem' states. I've stripped down the kernel and talked with the freezer maintainer and we believe the jffs2 garbage collection threads may not be calling try_to_freeze() or marking themselves properly. (We have two mounted jffs2 file systems - mtd2 and mtd3). The following is some cleaned-up output:
Freezing remaining freezable tasks ...
Freezing of tasks failed after 20.00 seconds (2 tasks refusing to freeze):
task PC stack pid father
init D c0244b90 0 1 0 kthreadd S c0244b90 0 2 0 ksoftirqd/0 S c0244b90 0 3 2 events/0 S c0244b90 0 4 2 khelper S c0244b90 0 5 2 kblockd/0 S c0244b90 0 51 2 ksuspend_usbd D c0244b90 0 59 2 khubd D c0244b90 0 64 2 kseriod D c0244b90 0 67 2 pdflush D c0244b90 0 90 2 pdflush D c0244b90 0 91 2 kswapd0 D c0244b90 0 92 2 aio/0 S c0244b90 0 93 2 mtdblockd S c0244b90 0 192 2 udevd D c0244b90 0 619 1 jffs2_gcd_mtd R running 0 1533 2 jffs2_gcd_mtd R running 0 1598 2 syslogd D c0244b90 0 2248 1 klogd D c0244b90 0 2250 1 hcid D c0244b90 0 2273 1 sdpd D c0244b90 0 2277 1 hidd D c0244b90 0 2281 1 sh D c0244b90 0 2292 1 getty D c0244b90 0 2293 1 echo R running 0 2303 2292
jffs2_gcd_mtd2
jffs2_gcd_mtd3
Restarting tasks ... done.
PATCH 1/1 Freezer: Fix JFFS2 garbage collector freezing issue (was: Re: JFFS2 garbage collection threads not freezing?)
Quoted 35 lines · Pete MacKay
We've ported from 2.6.18 to 2.6.24-rc3 on a pxa270-based machine and can no longer enter 'standby' or 'mem' states. I've stripped down the kernel and talked with the freezer maintainer and we believe the jffs2 garbage collection threads may not be calling
try_to_freeze()or marking themselves properly. (We have two mounted jffs2 file systems - mtd2 and mtd3). The following is some cleaned-up output:Freezing remaining freezable tasks ...
Freezing of tasks failed after 20.00 seconds (2 tasks refusing to freeze):
task PC stack pid fatherinit D c0244b90 0 1 0 kthreadd S c0244b90 0 2 0 ksoftirqd/0 S c0244b90 0 3 2 events/0 S c0244b90 0 4 2 khelper S c0244b90 0 5 2 kblockd/0 S c0244b90 0 51 2 ksuspend_usbd D c0244b90 0 59 2 khubd D c0244b90 0 64 2 kseriod D c0244b90 0 67 2 pdflush D c0244b90 0 90 2 pdflush D c0244b90 0 91 2 kswapd0 D c0244b90 0 92 2 aio/0 S c0244b90 0 93 2 mtdblockd S c0244b90 0 192 2 udevd D c0244b90 0 619 1 jffs2_gcd_mtd R running 0 1533 2 jffs2_gcd_mtd R running 0 1598 2 syslogd D c0244b90 0 2248 1 klogd D c0244b90 0 2250 1 hcid D c0244b90 0 2273 1 sdpd D c0244b90 0 2277 1 hidd D c0244b90 0 2281 1 sh D c0244b90 0 2292 1 getty D c0244b90 0 2293 1 echo R running 0 2303 2292
Quoted 4 lines
jffs2_gcd_mtd2
jffs2_gcd_mtd3Restarting tasks ... done.
I think that the appended patch is necessary to fix this problem.
Greetings,
Rafael
---
Subject: Freezer: Fix JFFS2 garbage collector freezing issue
From: Rafael J. Wysocki <[email protected]>
Fix breakage caused by commit d5d8c5976d6adeddb8208c240460411e2198b393 "freezer: do not send signals to kernel threads" in jffs2_garbage_collect_thread() that assumed it would be sent signals by the freezer.
--- fs/jffs2/background.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/jffs2/background.c +5 -3
@@ -103,15 +103,17 @@ static int jffs2_garbage_collect_thread(get there first. */ yield (); +/* If system suspend is in progress, go to the refrigerator and +start again when the suspend is done */ +if (try_to_freeze ()) + goto again; +/* Put_super will send a SIGKILL and then wait on the sem. */ while (signal_pending (current)) {siginfo_t info;unsigned long signr; -if (try_to_freeze ()) - goto again; - signr =dequeue_signal_lock (current, ¤t->blocked, &info);switch (signr) {
Re: [PATCH] Freezer: Fix JFFS2 garbage collector freezing issue (was: Re: JFFS2 garbage collection threads not freezing?)
Quoted 1 line · Rafael J. Wysocki
On Friday, 30 of November 2007, Pete MacKay wrote:
[--snip--]
Quoted 21 lines
---
Subject: Freezer: Fix JFFS2 garbage collector freezing issue
From: Rafael J. Wysocki <[email protected]>Fix breakage caused by commit
d5d8c5976d6adeddb8208c240460411e2198b393"freezer: do not send signals to kernel threads" injffs2_garbage_collect_thread()that assumed it would be sent signals by the freezer.Signed-off-by Rafael J. Wysocki <[email protected]>Cc Pete MacKay <[email protected]>Cc Andrew Morton <[email protected]>--- fs/jffs2/background.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)Index:
linux-2.6/fs/jffs2/background.c
===================================================================
fs/jffs2/background.c static int jffs2_garbage_collect_thread( · line 110
Quoted 8 lines
fs/jffs2/background.c +5
-0@@ -103,15 +103,17 @@ static int jffs2_garbage_collect_thread(get there first. */ yield (); +/* If system suspend is in progress, go to the refrigerator and +start again when the suspend is done */ +if (try_to_freeze ()) + goto again; +
This still has the problem that, if the freeze request comes exactly here, the loop below will not allow us to freeze.
fs/jffs2/background.c static int jffs2_garbage_collect_thread(
Quoted 13 lines
fs/jffs2/background.c +0
-4/* Put_super will send a SIGKILL and then wait on the sem. */ while (signal_pending (current)) {siginfo_t info;unsigned long signr; -if (try_to_freeze ()) - goto again; - signr =dequeue_signal_lock (current, ¤t->blocked, &info);switch (signr) { --
I'll send another patch for this in a while.
Greetings,
Rafael