Skip to contentSkip to conversation

mm-hugetlb-move-the-error-handle-logic-out-of-normal-code-path.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 5, 2014

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: [merged] mm-hugetlb-move-the-error-handle-logic-out-of-normal-code-path.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 05 Jun 2014 12:52:57 -0700

The patch titled
Subject: mm, hugetlb: move the error handle logic out of normal code path
has been removed from the -mm tree. Its filename was
mm-hugetlb-move-the-error-handle-logic-out-of-normal-code-path.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Jianyu Zhan <[email protected]>
Subject: mm, hugetlb: move the error handle logic out of normal code path

alloc_huge_page() now mixes normal code path with error handle logic. This patches move out the error handle logic, to make normal code path more clean and redue code duplicate.

---

 mm/hugetlb.c |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
mm/hugetlb.c renamed from mm/hugetlb.c~mm-hugetlb-move-the-error-handle-logic-out-of-normal-code-path +13 -13
diff -puN mm/hugetlb.c~mm-hugetlb-move-the-error-handle-logic-out-of-normal-code-path mm/hugetlb.c
@@ -1386,24 +1386,17 @@ static struct page *alloc_huge_page(stru
 			return ERR_PTR(-ENOSPC);
 
 	ret = hugetlb_cgroup_charge_cgroup(idx, pages_per_huge_page(h), &h_cg);
-	if (ret) {
-		if (chg || avoid_reserve)
-			hugepage_subpool_put_pages(spool, 1);
-		return ERR_PTR(-ENOSPC);
-	}
+	if (ret)
+		goto out_subpool_put;
+
 	spin_lock(&hugetlb_lock);
 	page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, chg);
 	if (!page) {
 		spin_unlock(&hugetlb_lock);
 		page = alloc_buddy_huge_page(h, NUMA_NO_NODE);
-		if (!page) {
-			hugetlb_cgroup_uncharge_cgroup(idx,
-						       pages_per_huge_page(h),
-						       h_cg);
-			if (chg || avoid_reserve)
-				hugepage_subpool_put_pages(spool, 1);
-			return ERR_PTR(-ENOSPC);
-		}
+		if (!page)
+			goto out_uncharge_cgroup;
+
 		spin_lock(&hugetlb_lock);
 		list_move(&page->lru, &h->hugepage_activelist);
 		/* Fall through */
@@ -1415,6 +1408,13 @@ static struct page *alloc_huge_page(stru
 
 	vma_commit_reservation(h, vma, addr);
 	return page;
+
+out_uncharge_cgroup:
+	hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg);
+out_subpool_put:
+	if (chg || avoid_reserve)
+		hugepage_subpool_put_pages(spool, 1);
+	return ERR_PTR(-ENOSPC);
 }
 
 /*

_

Patches currently in -mm which might be from [email protected] are

origin.patch
linux-next.patch mm-memcontrol-clean-up-memcg-zoneinfo-lookup.patch mm-memcontrol-remove-unnecessary-memcg-argument-from-soft-limit-functions.patch