diff options
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 7c204e3d132b..976bbc5646fe 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |
19 | #include <linux/sysfs.h> | 19 | #include <linux/sysfs.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/mmdebug.h> | ||
21 | #include <linux/sched/signal.h> | 22 | #include <linux/sched/signal.h> |
22 | #include <linux/rmap.h> | 23 | #include <linux/rmap.h> |
23 | #include <linux/string_helpers.h> | 24 | #include <linux/string_helpers.h> |
@@ -1583,7 +1584,7 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, | |||
1583 | page = NULL; | 1584 | page = NULL; |
1584 | } else { | 1585 | } else { |
1585 | h->surplus_huge_pages++; | 1586 | h->surplus_huge_pages++; |
1586 | h->nr_huge_pages_node[page_to_nid(page)]++; | 1587 | h->surplus_huge_pages_node[page_to_nid(page)]++; |
1587 | } | 1588 | } |
1588 | 1589 | ||
1589 | out_unlock: | 1590 | out_unlock: |
@@ -4374,6 +4375,12 @@ int hugetlb_reserve_pages(struct inode *inode, | |||
4374 | struct resv_map *resv_map; | 4375 | struct resv_map *resv_map; |
4375 | long gbl_reserve; | 4376 | long gbl_reserve; |
4376 | 4377 | ||
4378 | /* This should never happen */ | ||
4379 | if (from > to) { | ||
4380 | VM_WARN(1, "%s called with a negative range\n", __func__); | ||
4381 | return -EINVAL; | ||
4382 | } | ||
4383 | |||
4377 | /* | 4384 | /* |
4378 | * Only apply hugepage reservation if asked. At fault time, an | 4385 | * Only apply hugepage reservation if asked. At fault time, an |
4379 | * attempt will be made for VM_NORESERVE to allocate a page | 4386 | * attempt will be made for VM_NORESERVE to allocate a page |