All of lore.kernel.org
 help / color / mirror / Atom feed
From: Uli Luckas <u.luckas@road.de>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] jffs2_gcd_mtd3, Stopping kernel threads timed out
Date: Tue, 12 Jun 2007 12:58:02 -0000	[thread overview]
Message-ID: <200706121451.16904.u.luckas@road.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

Hi
We experience the following problem when our board tries to suspend:

Jun  7 18:32:21 constin kernel: [ 2085.350000] Stopping tasks ... 
Jun  7 18:32:21 constin kernel: [ 2105.410000] Stopping kernel threads timed 
out after 20 seconds (1 tasks refusing to freeze):
Jun  7 18:32:21 constin kernel: [ 2105.410000]  jffs2_gcd_mtd3
Jun  7 18:32:21 constin kernel: [ 2105.410000] Restarting tasks ... <4> 
Strange, jffs2_gcd_mtd3 not stopped
Jun  7 18:32:21 constin kernel: [ 2105.440000] done.

The problem seems to happen, when suspend kicks in, after the call to 
try_to_freeze and before the while loop in jffs2_garbage_collect_thread.

The pending freeze will cause signal_pending to return true until the 
attempted suspend is over and thereby the while loop won't terminate until 
the suspend times out.

This patch will call try_to_freeze from within the while loop and adds an 
extra check for jffs2_thread_should_wake before we actually do the GC to 
avoid calling jffs2_garbage_collect_pass at every wakeup.

If there are no objections, please apply and push to mainline.

Signed-off-by: Uli Luckas <u.luckas@road.de>
-- 

------- ROAD ...the handyPC Company - - -  ) ) )

Uli Luckas
Software Development

ROAD GmbH
Bennigsenstr. 14 | 12159 Berlin | Germany
fon: +49 (30) 230069 - 64 | fax: +49 (30) 230069 - 69
url: www.road.de

Amtsgericht Charlottenburg: HRB 96688 B
Managing directors: Hans-Peter Constien, Hubertus von Streit

[-- Attachment #2: freeze_gc_thread.c --]
[-- Type: text/x-csrc, Size: 1156 bytes --]

diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 888f236..43a2fc8 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -96,9 +96,6 @@ static int jffs2_garbage_collect_thread(void *_c)
 			schedule();
 		}
 
-		if (try_to_freeze())
-			continue;
-
 		/* This thread is purely an optimisation. But if it runs when
 		   other things could be running, it actually makes things a
 		   lot worse. Use yield() and put it at the back of the runqueue
@@ -113,6 +110,9 @@ static int jffs2_garbage_collect_thread(void *_c)
 			siginfo_t info;
 			unsigned long signr;
 
+			if (try_to_freeze())
+				continue;
+
 			signr = dequeue_signal_lock(current, &current->blocked, &info);
 
 			switch(signr) {
@@ -137,7 +137,7 @@ static int jffs2_garbage_collect_thread(void *_c)
 		disallow_signal(SIGHUP);
 
 		D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n"));
-		if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
+		if (jffs2_thread_should_wake(c) && jffs2_garbage_collect_pass(c) == -ENOSPC) {
 			printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n");
 			goto die;
 		}

             reply	other threads:[~2007-06-12 12:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 12:58 Uli Luckas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-14 13:09 [PATCH] jffs2_gcd_mtd3, Stopping kernel threads timed out Uli Luckas
2007-06-19  9:49 ` Uli Luckas
2007-06-26 13:06   ` Uli Luckas
2007-06-26 13:19     ` Josh Boyer
2007-06-26 15:34       ` Uli Luckas
2007-06-28 18:52 ` David Woodhouse
2007-06-29  8:24   ` Uli Luckas
2007-06-29  8:28     ` David Woodhouse
2007-06-29  8:59       ` Uli Luckas
2007-07-24  7:35   ` Uli Luckas
2007-06-12 12:13 Uli Luckas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200706121451.16904.u.luckas@road.de \
    --to=u.luckas@road.de \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.