linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation: fix a hugetlbfs reservation statement
@ 2026-03-02 20:10 Jane Chu
  0 siblings, 0 replies; only message in thread
From: Jane Chu @ 2026-03-02 20:10 UTC (permalink / raw)
  To: akpm
  Cc: muchun.song, osalvador, david, lorenzo.stoakes, Liam.Howlett,
	vbabka, rppt, surenb, mhocko, skhan, corbet, hillf.zj, linux-mm,
	linux-doc, linux-kernel

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")
Signed-off-by: Jane Chu <jane.chu@oracle.com>
---
 Documentation/mm/hugetlbfs_reserv.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/mm/hugetlbfs_reserv.rst b/Documentation/mm/hugetlbfs_reserv.rst
index 4914fbf07966..a49115db18c7 100644
--- a/Documentation/mm/hugetlbfs_reserv.rst
+++ b/Documentation/mm/hugetlbfs_reserv.rst
@@ -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
-- 
2.43.5



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-02 20:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 20:10 [PATCH] Documentation: fix a hugetlbfs reservation statement Jane Chu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox