Skip to content

Commit

Permalink
[PATCH] uml: use GFP_ATOMIC for allocations under spinlocks.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paolo 'Blaisorblade' Giarrusso authored and Linus Torvalds committed Sep 23, 2005
1 parent 46db4a4 commit 79ae2cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/um/drivers/chan_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion arch/um/kernel/sigio_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 79ae2cb

Please sign in to comment.