Skip to contentSkip to conversation

hugetlbfs: coordinate global and subpool reserve accounting

RFC Hillf Danton 2 participants 2 messages Feb 28, 2015 Memory management

lore
Share & tools
lore
#0 lore raw

Review int hugetlb_reserve_pages(struct inode *inode, · line 3447

Quoted 4 lines
(quoted diff) +0 -0
@@ -3444,10 +3445,14 @@ int hugetlb_reserve_pages(struct inode *inode,
 	 * Check enough hugepages are available for the reservation.
 	 * Hand the pages back to the subpool if there are not
 	 */

Better if comment is updated correspondingly.
Hillf

Quoted 14 lines
(quoted diff) +8 -4
-	ret = hugetlb_acct_memory(h, chg);
-	if (ret < 0) {
-		hugepage_subpool_put_pages(spool, chg);
-		goto out_err;
+	if (subpool_reserved(spool))
+		ret = 0;
+	else {
+		ret = hugetlb_acct_memory(h, chg);
+		if (ret < 0) {
+			hugepage_subpool_put_pages(spool, chg);
+			goto out_err;
+		}
 	}
 
#1 lore raw
Quoted 7 lines · Hillf Danton

Review int hugetlb_reserve_pages(struct inode *inode, · line 3447

Quoted 4 lines
(quoted diff) +0 -0
@@ -3444,10 +3445,14 @@ int hugetlb_reserve_pages(struct inode *inode,
  	 * Check enough hugepages are available for the reservation.
  	 * Hand the pages back to the subpool if there are not
  	 */

Better if comment is updated correspondingly.
Hillf

Thanks Hillf. I'll also take a look at other comments in the area of 'accounting'. As I discovered, it is only a matter of adjusting the accounting to support reservation of pages for the entire filesystem.

Signature · 1 line
Mike Kravetz
Quoted 6 lines
Quoted 6 lines
(quoted diff) +2 -4
-	ret = hugetlb_acct_memory(h, chg);
-	if (ret < 0) {
-		hugepage_subpool_put_pages(spool, chg);
-		goto out_err;
+	if (subpool_reserved(spool))
+		ret = 0;
Quoted 8 lines

Review int hugetlb_reserve_pages(struct inode *inode, · line 3457

Quoted 8 lines
(quoted diff) +6 -0
+	else {
+		ret = hugetlb_acct_memory(h, chg);
+		if (ret < 0) {
+			hugepage_subpool_put_pages(spool, chg);
+			goto out_err;
+		}
  	}
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>