1 From 9706327002caebe6633c93e605882ea37172ec57 Mon Sep 17 00:00:00 2001
2 From: Andres Salomon <dilinger@debian.org>
3 Date: Mon, 3 Nov 2008 01:08:25 +0000
4 Subject: [PATCH] jffs2-choke-gc-thread.patch
6 I've noticed some pretty poor behavior on OLPC machines after bootup, when
7 gdm/X are starting. The GCD monopolizes the scheduler (which in turns means
8 it gets to do more nand i/o), which results in processes taking much much
9 longer than they should to start.
11 As an example, on an OLPC machine going from OFW to a usable X (via auto-login
12 gdm) takes 2m 30s. The majority of this time is consumed by the switch into
13 graphical mode. With this patch, we cut a full 60s off of bootup time. After
14 bootup, things are much snappier as well.
16 Note that we have seen a CRC node error with this patch that causes the machine
17 to fail to boot, but we've also seen that problem without this patch.
19 Signed-off-by: Andres Salomon <dilinger@debian.org>
21 fs/jffs2/background.c | 18 +++++++++++-------
22 1 files changed, 11 insertions(+), 7 deletions(-)
24 diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
25 index 8adebd3..f38d557 100644
26 --- a/fs/jffs2/background.c
27 +++ b/fs/jffs2/background.c
28 @@ -95,13 +95,17 @@ static int jffs2_garbage_collect_thread(void *_c)
32 - /* This thread is purely an optimisation. But if it runs when
33 - other things could be running, it actually makes things a
34 - lot worse. Use yield() and put it at the back of the runqueue
35 - every time. Especially during boot, pulling an inode in
36 - with read_inode() is much preferable to having the GC thread
39 + /* Problem - immediately after bootup, the GCD spends a lot
40 + * of time in places like jffs2_kill_fragtree(); so much so
41 + * that userspace processes (like gdm and X) are starved
42 + * despite plenty of cond_resched()s and renicing. Yield()
43 + * doesn't help, either (presumably because userspace and GCD
44 + * are generally competing for a higher latency resource -
46 + * This forces the GCD to slow the hell down. Pulling an
47 + * inode in with read_inode() is much preferable to having
48 + * the GC thread get there first. */
49 + schedule_timeout_interruptible(msecs_to_jiffies(50));
51 /* Put_super will send a SIGKILL and then wait on the sem.