[JFFS2] force the jffs2 GC daemon to behave a bit better

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Feb 14 04:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=efab0b5d3eed6aa71f8e3233e4e11774eedc04dc
Commit:     efab0b5d3eed6aa71f8e3233e4e11774eedc04dc
Parent:     ab00d68276295a1b4da7ad924a35a3566e9c2698
Author:     Andres Salomon <dilinger at queued.net>
AuthorDate: Wed Feb 11 13:27:02 2009 -0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Feb 14 08:59:04 2009 +0000

    [JFFS2] force the jffs2 GC daemon to behave a bit better
    
    I've noticed some pretty poor behavior on OLPC machines after bootup, when
    gdm/X are starting.  The GCD monopolizes the scheduler (which in turns
    means it gets to do more nand i/o), which results in processes taking much
    much longer than they should to start.
    
    As an example, on an OLPC machine going from OFW to a usable X (via
    auto-login gdm) takes 2m 30s.  The majority of this time is consumed by
    the switch into graphical mode.  With this patch, we cut a full 60s off of
    bootup time.  After bootup, things are much snappier as well.
    
    Note that we have seen a CRC node error with this patch that causes the machine
    to fail to boot, but we've also seen that problem without this patch.
    
    Signed-off-by: Andres Salomon <dilinger at debian.org>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 fs/jffs2/background.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 3cceef4..e958010 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -95,13 +95,17 @@ static int jffs2_garbage_collect_thread(void *_c)
 			spin_unlock(&c->erase_completion_lock);
 			
 
-		/* 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
-		   every time. Especially during boot, pulling an inode in
-		   with read_inode() is much preferable to having the GC thread
-		   get there first. */
-		yield();
+		/* Problem - immediately after bootup, the GCD spends a lot
+		 * of time in places like jffs2_kill_fragtree(); so much so
+		 * that userspace processes (like gdm and X) are starved
+		 * despite plenty of cond_resched()s and renicing.  Yield()
+		 * doesn't help, either (presumably because userspace and GCD
+		 * are generally competing for a higher latency resource -
+		 * disk).
+		 * This forces the GCD to slow the hell down.   Pulling an
+		 * inode in with read_inode() is much preferable to having
+		 * the GC thread get there first. */
+		schedule_timeout_interruptible(msecs_to_jiffies(50));
 
 		/* Put_super will send a SIGKILL and then wait on the sem.
 		 */



More information about the linux-mtd-cvs mailing list