Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61650
b: refs/heads/master
c: 7ed5cb2
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Jul 19, 2007
1 parent f0d3498 commit e39f559
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 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: e3aded3cc289113c7bc729ef4cb75e56d9aa71be
refs/heads/master: 7ed5cb2b73d0c4165c0504c95454fade0c0bf3d9
10 changes: 7 additions & 3 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,19 @@ static int alloc_fresh_huge_page(void)
{
static int prev_nid;
struct page *page;
static DEFINE_SPINLOCK(nid_lock);
int nid;

spin_lock(&nid_lock);
/*
* Copy static prev_nid to local nid, work on that, then copy it
* back to prev_nid afterwards: otherwise there's a window in which
* a racer might pass invalid nid MAX_NUMNODES to alloc_pages_node.
* But we don't need to use a spin_lock here: it really doesn't
* matter if occasionally a racer chooses the same nid as we do.
*/
nid = next_node(prev_nid, node_online_map);
if (nid == MAX_NUMNODES)
nid = first_node(node_online_map);
prev_nid = nid;
spin_unlock(&nid_lock);

page = alloc_pages_node(nid, htlb_alloc_mask|__GFP_COMP|__GFP_NOWARN,
HUGETLB_PAGE_ORDER);
Expand Down

0 comments on commit e39f559

Please sign in to comment.