Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283029
b: refs/heads/master
c: 1ebb704
h: refs/heads/master
i:
  283027: 61c3cfb
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Jan 11, 2012
1 parent 4bb7efc commit 1bdecfd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0565d317768cc66b13e37184f29d9f270c2886dc
refs/heads/master: 1ebb7044c9142c67d1d2b04d84010b4810a43fd8
13 changes: 11 additions & 2 deletions trunk/mm/mempool.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,23 @@ void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask)
return element;
}

/* We must not sleep in the GFP_ATOMIC case */
/*
* We use gfp mask w/o __GFP_WAIT or IO for the first round. If
* alloc failed with that and @pool was empty, retry immediately.
*/
if (gfp_temp != gfp_mask) {
spin_unlock_irqrestore(&pool->lock, flags);
gfp_temp = gfp_mask;
goto repeat_alloc;
}

/* We must not sleep if !__GFP_WAIT */
if (!(gfp_mask & __GFP_WAIT)) {
spin_unlock_irqrestore(&pool->lock, flags);
return NULL;
}

/* Let's wait for someone else to return an element to @pool */
gfp_temp = gfp_mask;
init_wait(&wait);
prepare_to_wait(&pool->wait, &wait, TASK_UNINTERRUPTIBLE);

Expand Down

0 comments on commit 1bdecfd

Please sign in to comment.