diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/hugetlb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 728e9bda12ea..3e52df7c471b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -22,6 +22,10 @@ unsigned long max_huge_pages; | |||
22 | static struct list_head hugepage_freelists[MAX_NUMNODES]; | 22 | static struct list_head hugepage_freelists[MAX_NUMNODES]; |
23 | static unsigned int nr_huge_pages_node[MAX_NUMNODES]; | 23 | static unsigned int nr_huge_pages_node[MAX_NUMNODES]; |
24 | static unsigned int free_huge_pages_node[MAX_NUMNODES]; | 24 | static unsigned int free_huge_pages_node[MAX_NUMNODES]; |
25 | |||
26 | /* | ||
27 | * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages | ||
28 | */ | ||
25 | static DEFINE_SPINLOCK(hugetlb_lock); | 29 | static DEFINE_SPINLOCK(hugetlb_lock); |
26 | 30 | ||
27 | static void enqueue_huge_page(struct page *page) | 31 | static void enqueue_huge_page(struct page *page) |
@@ -61,8 +65,10 @@ static struct page *alloc_fresh_huge_page(void) | |||
61 | HUGETLB_PAGE_ORDER); | 65 | HUGETLB_PAGE_ORDER); |
62 | nid = (nid + 1) % num_online_nodes(); | 66 | nid = (nid + 1) % num_online_nodes(); |
63 | if (page) { | 67 | if (page) { |
68 | spin_lock(&hugetlb_lock); | ||
64 | nr_huge_pages++; | 69 | nr_huge_pages++; |
65 | nr_huge_pages_node[page_to_nid(page)]++; | 70 | nr_huge_pages_node[page_to_nid(page)]++; |
71 | spin_unlock(&hugetlb_lock); | ||
66 | } | 72 | } |
67 | return page; | 73 | return page; |
68 | } | 74 | } |