diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-01-18 20:42:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:21 -0500 |
commit | b63162939cd797c8269964ce856ed1f2fec5f70e (patch) | |
tree | 666dd2919bd156aa183a87576224d0fad3c4cf72 /arch/um/kernel/process_kern.c | |
parent | b6a2b13778873bd9edd0b4a7d24a7bd730369021 (diff) |
[PATCH] uml: avoid malloc to sleep in atomic sections
Ugly trick to help make malloc not sleeping - we can't do anything else. But
this is not yet optimal, since spinlock don't trigger in_atomic() when
preemption is disabled.
Also, even if ugly, this was already used in one place, and was even more
bogus. Fix it.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/kernel/process_kern.c')
-rw-r--r-- | arch/um/kernel/process_kern.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index e167cf0a71f4..3113cab8675e 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c | |||
@@ -287,17 +287,27 @@ EXPORT_SYMBOL(disable_hlt); | |||
287 | 287 | ||
288 | void *um_kmalloc(int size) | 288 | void *um_kmalloc(int size) |
289 | { | 289 | { |
290 | return(kmalloc(size, GFP_KERNEL)); | 290 | return kmalloc(size, GFP_KERNEL); |
291 | } | 291 | } |
292 | 292 | ||
293 | void *um_kmalloc_atomic(int size) | 293 | void *um_kmalloc_atomic(int size) |
294 | { | 294 | { |
295 | return(kmalloc(size, GFP_ATOMIC)); | 295 | return kmalloc(size, GFP_ATOMIC); |
296 | } | 296 | } |
297 | 297 | ||
298 | void *um_vmalloc(int size) | 298 | void *um_vmalloc(int size) |
299 | { | 299 | { |
300 | return(vmalloc(size)); | 300 | return vmalloc(size); |
301 | } | ||
302 | |||
303 | void *um_vmalloc_atomic(int size) | ||
304 | { | ||
305 | return __vmalloc(size, GFP_ATOMIC | __GFP_HIGHMEM, PAGE_KERNEL); | ||
306 | } | ||
307 | |||
308 | int __cant_sleep(void) { | ||
309 | return in_atomic() || irqs_disabled() || in_interrupt(); | ||
310 | /* Is in_interrupt() really needed? */ | ||
301 | } | 311 | } |
302 | 312 | ||
303 | unsigned long get_fault_addr(void) | 313 | unsigned long get_fault_addr(void) |
@@ -369,11 +379,6 @@ int smp_sigio_handler(void) | |||
369 | return(0); | 379 | return(0); |
370 | } | 380 | } |
371 | 381 | ||
372 | int um_in_interrupt(void) | ||
373 | { | ||
374 | return(in_interrupt()); | ||
375 | } | ||
376 | |||
377 | int cpu(void) | 382 | int cpu(void) |
378 | { | 383 | { |
379 | return(current_thread->cpu); | 384 | return(current_thread->cpu); |