From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DEB42BE7BA; Wed, 20 May 2026 17:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298287; cv=none; b=EqJbVpVj6mMENFHtnqGSqKMrZwj7J9IB7hZwY4vekoqpy/edZ/qVCa7xByhh9heiwHeot8F3P+VfwsQ+68w+525IWukbgx1pSA5aC60VrXvwIeyoF9YTwhj9tL1ElDxjSEphmuHD1DyNqWopYkXTuXJY05s7opeKnijVaVjDOHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779298287; c=relaxed/simple; bh=zS5AcYWMLGR6A/WEtC8HIgFTMVOTh66p8gSYc+Jin/c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RJ1QtHbSDlj7DrghPLhLGmb9fm62fJiJLoyDq+uKodr2w2Pp4T72d90cFyG1iYyovXqh+tMBXNhDNONB3wrlu58I2N0ceGZMaoPXGZlJE+fvLke+fWPSmLCQ70l1MZG4f+EtvqYNFMt9VT7h6e/FpfB36FXktTMNVeKOzlQemVE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eaQIJast; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eaQIJast" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB5771F00893; Wed, 20 May 2026 17:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779298286; bh=tPHYin3srlTHHRTyGoLipUYIz1HfXYk3AJL5ZkFCD9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eaQIJastwLdQiKzLaCk5kwFANFyw+UDMkpLJspLsrAVu2v6C4PMlHz9ALowOtefE1 QNgz7MyKedxPy//GtJRiLwbfRlKyKtzIKgeLoOCZ20X7x0/aJOJv4ZSz4YqatGAxvT I9FVuay0Z7l9k/aajaUAjp8FPvBEWGNtMxX09h1o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jane Chu , David Hildenbrand , Hillf Danton , Jonathan Corbet , Liam Howlett , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Muchun Song , Oscar Salvador , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , Andrew Morton , Sasha Levin Subject: [PATCH 6.18 312/957] Documentation: fix a hugetlbfs reservation statement Date: Wed, 20 May 2026 18:13:15 +0200 Message-ID: <20260520162141.298767941@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jane Chu [ Upstream commit 7a197d346a44384a1a858a98ef03766840e561d4 ] 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. Link: https://lkml.kernel.org/r/20260302201015.1824798-1-jane.chu@oracle.com Fixes: 70bc0dc578b3 ("Documentation: vm, add hugetlbfs reservation overview") Signed-off-by: Jane Chu Cc: David Hildenbrand Cc: Hillf Danton Cc: Jonathan Corbet Cc: Liam Howlett Cc: Lorenzo Stoakes Cc: Michal Hocko Cc: Mike Rapoport Cc: Muchun Song Cc: Oscar Salvador Cc: Shuah Khan Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- 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 4914fbf07966c..a49115db18c76 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.53.0