Skip to contentSkip to conversation

Documentation: fix a hugetlbfs reservation statement

PATCH Applied Jane Chu 1 participant 1 message Mar 2

Subsystems (4)
lore
Share & tools
lore

Jane Chu

author
#0 lore raw

PATCH 1/1 Documentation: fix a hugetlbfs reservation statement

Documentation/mm/hugetlbfs_reserv.rst has

	if (resv_needed <= (resv_huge_pages - free_huge_pages))
		resv_huge_pages += resv_needed;
which describes this code in gather_surplus_pages()
	needed = (h->resv_huge_pages + delta) - h->free_huge_pages;
	if (needed <= 0) {
		h->resv_huge_pages += delta;
		return 0;
	}

which means if there are enough free hugepages to account for the new reservation, simply update the global reservation count without further action.

But the description is backwards, it should be
if (resv_needed <= (free_huge_pages - resv_huge_pages))
instead.

Fixes 70bc0dc578b3f ("Documentation: vm, add hugetlbfs reservation overview")
---
 Documentation/mm/hugetlbfs_reserv.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/mm/hugetlbfs_reserv.rst +1 -1
index 4914fbf07966..a49115db18c7 100644
@@ -155,7 +155,7 @@ are enough free huge pages to accommodate the reservation.  If there are,
 the global reservation count resv_huge_pages is adjusted something like the
 following::
 
-	if (resv_needed <= (resv_huge_pages - free_huge_pages))
+	if (resv_needed <= (free_huge_pages - resv_huge_pages)
 		resv_huge_pages += resv_needed;
 
 Note that the global lock hugetlb_lock is held when checking and adjusting
Signature · 1 line
2.43.5