]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] uml: use GFP_ATOMIC for allocations under spinlocks.
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Fri, 23 Sep 2005 04:44:21 +0000 (21:44 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Sep 2005 05:17:37 +0000 (22:17 -0700)
setup_initial_poll is only called with sigio_lock() held, so use appropriate
allocation.

Also, parse_chan() can also be called when holding a spinlock (see line_open()
 -> parse_chan_pair()).

I have sporadic problems (spinlock taken twice, with spinlock debugging on UP)
which could be caused by a sequence like "take spinlock, alloc and go to
sleep, take again the spinlock in the other thread".

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>
arch/um/drivers/chan_kern.c
arch/um/kernel/sigio_user.c

index 14a12d6b3df6e89c695860170ce10145d1556f0d..244e54a2153b3cb2a93fcf0f0b22d6d23d9107d9 100644 (file)
@@ -465,7 +465,7 @@ static struct chan *parse_chan(char *str, int pri, int device,
        data = (*ops->init)(str, device, opts);
        if(data == NULL) return(NULL);
 
-       chan = kmalloc(sizeof(*chan), GFP_KERNEL);
+       chan = kmalloc(sizeof(*chan), GFP_ATOMIC);
        if(chan == NULL) return(NULL);
        *chan = ((struct chan) { .list          = LIST_HEAD_INIT(chan->list),
                                 .primary       = 1,
index e89218958f38c4bbe9bd1473363a862235ad4fcd..a52751108aa125c3299926efdb8d8aad53496a72 100644 (file)
@@ -340,7 +340,7 @@ static int setup_initial_poll(int fd)
 {
        struct pollfd *p;
 
-       p = um_kmalloc(sizeof(struct pollfd));
+       p = um_kmalloc_atomic(sizeof(struct pollfd));
        if(p == NULL){
                printk("setup_initial_poll : failed to allocate poll\n");
                return(-1);