diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2013-09-11 17:21:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:57:44 -0400 |
commit | 8bb3f12e7d4f7b043a7c5aa3831e72041e80dc4a (patch) | |
tree | be5c4ff792b8555a8d5fd3286d2714bff1d01a48 /mm/hugetlb.c | |
parent | f522c3ac00a49128115f99a5fcb95a447601c1c3 (diff) |
mm, hugetlb: fix subpool accounting handling
If we alloc hugepage with avoid_reserve, we don't dequeue reserved one.
So, we should check subpool counter when avoid_reserve. This patch
implement it.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Davidlohr Bueso <davidlohr@hp.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Hillf Danton <dhillf@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/hugetlb.c')
-rw-r--r-- | mm/hugetlb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 204550ae29c8..dec5772c8c5c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -1164,13 +1164,14 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, | |||
1164 | chg = vma_needs_reservation(h, vma, addr); | 1164 | chg = vma_needs_reservation(h, vma, addr); |
1165 | if (chg < 0) | 1165 | if (chg < 0) |
1166 | return ERR_PTR(-ENOMEM); | 1166 | return ERR_PTR(-ENOMEM); |
1167 | if (chg) | 1167 | if (chg || avoid_reserve) |
1168 | if (hugepage_subpool_get_pages(spool, chg)) | 1168 | if (hugepage_subpool_get_pages(spool, 1)) |
1169 | return ERR_PTR(-ENOSPC); | 1169 | return ERR_PTR(-ENOSPC); |
1170 | 1170 | ||
1171 | ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), &h_cg); | 1171 | ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), &h_cg); |
1172 | if (ret) { | 1172 | if (ret) { |
1173 | hugepage_subpool_put_pages(spool, chg); | 1173 | if (chg || avoid_reserve) |
1174 | hugepage_subpool_put_pages(spool, 1); | ||
1174 | return ERR_PTR(-ENOSPC); | 1175 | return ERR_PTR(-ENOSPC); |
1175 | } | 1176 | } |
1176 | spin_lock(&hugetlb_lock); | 1177 | spin_lock(&hugetlb_lock); |
@@ -1182,7 +1183,8 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, | |||
1182 | hugetlb_cgroup_uncharge_cgroup(idx, | 1183 | hugetlb_cgroup_uncharge_cgroup(idx, |
1183 | pages_per_huge_page(h), | 1184 | pages_per_huge_page(h), |
1184 | h_cg); | 1185 | h_cg); |
1185 | hugepage_subpool_put_pages(spool, chg); | 1186 | if (chg || avoid_reserve) |
1187 | hugepage_subpool_put_pages(spool, 1); | ||
1186 | return ERR_PTR(-ENOSPC); | 1188 | return ERR_PTR(-ENOSPC); |
1187 | } | 1189 | } |
1188 | spin_lock(&hugetlb_lock); | 1190 | spin_lock(&hugetlb_lock); |