[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>
This commit is contained in:
committed by
Linus Torvalds
parent
b6a2b13778
commit
b63162939c
@@ -287,17 +287,27 @@ EXPORT_SYMBOL(disable_hlt);
|
||||
|
||||
void *um_kmalloc(int size)
|
||||
{
|
||||
return(kmalloc(size, GFP_KERNEL));
|
||||
return kmalloc(size, GFP_KERNEL);
|
||||
}
|
||||
|
||||
void *um_kmalloc_atomic(int size)
|
||||
{
|
||||
return(kmalloc(size, GFP_ATOMIC));
|
||||
return kmalloc(size, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
void *um_vmalloc(int size)
|
||||
{
|
||||
return(vmalloc(size));
|
||||
return vmalloc(size);
|
||||
}
|
||||
|
||||
void *um_vmalloc_atomic(int size)
|
||||
{
|
||||
return __vmalloc(size, GFP_ATOMIC | __GFP_HIGHMEM, PAGE_KERNEL);
|
||||
}
|
||||
|
||||
int __cant_sleep(void) {
|
||||
return in_atomic() || irqs_disabled() || in_interrupt();
|
||||
/* Is in_interrupt() really needed? */
|
||||
}
|
||||
|
||||
unsigned long get_fault_addr(void)
|
||||
@@ -369,11 +379,6 @@ int smp_sigio_handler(void)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int um_in_interrupt(void)
|
||||
{
|
||||
return(in_interrupt());
|
||||
}
|
||||
|
||||
int cpu(void)
|
||||
{
|
||||
return(current_thread->cpu);
|
||||
|
Reference in New Issue
Block a user