summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches/0213-sdio-use-interruptible-sleep-in-kthread-main-loops.patch
blob: e68c058109ea83b78dd5e52ac9c9db81029b42c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From cba59b243d542f3de9c534d99b2f3f33e50b3ebb Mon Sep 17 00:00:00 2001
From: Jason Uhlenkott <jasonuhl@jasonuhl.org>
Date: Fri, 25 Jul 2008 23:06:20 +0100
Subject: [PATCH] sdio: use interruptible sleep in kthread main loops

My FreeRunner's load average was leveling off at 2.00 as a result of
these two kernel threads:

SDIO Helper   D c02b4500     0   255      2
[<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158)
[<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20)
 r7:00000000 r6:c01fbd64 r5:c7cb7134 r4:c7d58000
[<c01fa6fc>] (CardDetectHelperFunction+0x0/0x1ac) from [<c01fbd80>] (HelperLaunch+0x1c/0x28)
 r5:c7cb7134 r4:c7cb7134
[<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94)
 r4:c7d58000
[<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744)
 r6:00000000 r5:00000000 r4:00000000

SDIO Helper   D c02b4500     0   259      2
[<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158)
[<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20)
 r7:c0382bb4 r6:c0382b34 r5:c7d5a000 r4:00000001
[<c01f9104>] (SDIOIrqHelperFunction+0x0/0x29c) from [<c01fbd80>] (HelperLaunch+0x1c/0x28)
 r8:00000000 r7:00000000 r6:c01fbd64 r5:c0382bb4 r4:c0382bb4
[<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94)
 r4:c7d5a000
[<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744)
 r6:00000000 r5:00000000 r4:00000000

This fixes them to use interruptible sleep primitives while waiting in
their main loops, as is conventional for kernel threads.  They can't
actually be interrupted since kernel threads ignore all signals, but
by sleeping this way they get classified as long term waiters, and
don't get counted as running for purposes of load average calculation.

This is intended as a minimal fix.  In the longer term, it'd probably
make sense to replace the semaphores with completions or something,
and to do away with some of these StudlyCapped wrapper functions.

Signed-off-by: Jason Uhlenkott <jasonuhl@jasonuhl.org>
--

This is untested, but what could possibly go wrong?  ;)
---
 include/linux/sdio/ctsystem_linux.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/sdio/ctsystem_linux.h b/include/linux/sdio/ctsystem_linux.h
index 0de89a6..c9e44f2 100644
--- a/include/linux/sdio/ctsystem_linux.h
+++ b/include/linux/sdio/ctsystem_linux.h
@@ -968,7 +968,7 @@ typedef struct _OSKERNEL_HELPER {
         }
 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-#define SD_WAIT_FOR_WAKEUP(p)   SignalWait(&(p)->WakeSignal);
+#define SD_WAIT_FOR_WAKEUP(p)   SignalWaitInterruptible(&(p)->WakeSignal);
 
 #define CT_LE16_TO_CPU_ENDIAN(x) __le16_to_cpu(x)
 #define CT_LE32_TO_CPU_ENDIAN(x) __le32_to_cpu(x)
-- 
1.5.6.3