diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2009-01-19 07:45:31 -0500 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2009-02-08 12:56:10 -0500 |
commit | 86532d8b167e71e24da8b564348b52977b76d15f (patch) | |
tree | 86cfa88409db2867ddfc45322f7cd3175b6accad /kernel | |
parent | 7a89bbc74937cd74a6bcf109cfc7c032109639be (diff) |
async: Handle kthread_run() return codes.
If we fail to create the manager thread, fall back to non-fastboot.
If we fail to create an async thread, try again after waiting for
a bit.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/async.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/async.c b/kernel/async.c index 0c90d500ab68..078d5ed150d1 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
@@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel. | |||
54 | #include <linux/sched.h> | 54 | #include <linux/sched.h> |
55 | #include <linux/init.h> | 55 | #include <linux/init.h> |
56 | #include <linux/kthread.h> | 56 | #include <linux/kthread.h> |
57 | #include <linux/delay.h> | ||
57 | #include <asm/atomic.h> | 58 | #include <asm/atomic.h> |
58 | 59 | ||
59 | static async_cookie_t next_cookie = 1; | 60 | static async_cookie_t next_cookie = 1; |
@@ -319,7 +320,11 @@ static int async_manager_thread(void *unused) | |||
319 | ec = atomic_read(&entry_count); | 320 | ec = atomic_read(&entry_count); |
320 | 321 | ||
321 | while (tc < ec && tc < MAX_THREADS) { | 322 | while (tc < ec && tc < MAX_THREADS) { |
322 | kthread_run(async_thread, NULL, "async/%i", tc); | 323 | if (IS_ERR(kthread_run(async_thread, NULL, "async/%i", |
324 | tc))) { | ||
325 | msleep(100); | ||
326 | continue; | ||
327 | } | ||
323 | atomic_inc(&thread_count); | 328 | atomic_inc(&thread_count); |
324 | tc++; | 329 | tc++; |
325 | } | 330 | } |
@@ -334,7 +339,9 @@ static int async_manager_thread(void *unused) | |||
334 | static int __init async_init(void) | 339 | static int __init async_init(void) |
335 | { | 340 | { |
336 | if (async_enabled) | 341 | if (async_enabled) |
337 | kthread_run(async_manager_thread, NULL, "async/mgr"); | 342 | if (IS_ERR(kthread_run(async_manager_thread, NULL, |
343 | "async/mgr"))) | ||
344 | async_enabled = 0; | ||
338 | return 0; | 345 | return 0; |
339 | } | 346 | } |
340 | 347 | ||