From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E74E032D7D9 for ; Mon, 27 Apr 2026 15:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777302735; cv=none; b=i/LGi62h6rWGrdsuRTa0qqSOWEyX/aXwHjQ3xlV9Cmsxf8AZdhTEShZoDczy/z0FjYcGwc3uDXDi9udTFO/xaAKSALyV1UQjPctvAuu5cecNTX4cx4OHDRG+sefuiqQE+8RIdCKEx6cHex55WQHRD/SU3Dhj0m4Sk/clTA+9apk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777302735; c=relaxed/simple; bh=F2b+BgWCQCTOwW+URnNYXQvaoDUWLyTfvwHMkvbYs0g=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=shqfQ4ZjB/C2RGntsvlD0nzgI76nBi6yi/w7pNJx6CWDcRtgYKLEYbtzRHJETtVMvv9egAqyxR0D/xkE+stuhfKDYgA5rAjZVvYfZJDU5cYABgUi2Quq+ir8lmhLScC5h63uR9D2KWYAzQdmfEM85bnuFNXfiwcLdfXpDt5onC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=VNchfyn7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="VNchfyn7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CEB2C19425; Mon, 27 Apr 2026 15:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1777302734; bh=F2b+BgWCQCTOwW+URnNYXQvaoDUWLyTfvwHMkvbYs0g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VNchfyn7ZVBpAYLhBCWBxxtf0e8OoTwEBd51jJaR8jYrXt0vHVBmMe98eAc6u8FU0 79ycQm6zD0OO+mwLfVS4YzPpa3yHKHU+tkO7nBYNEoxytZPzIL0SgGnqzLZZnmyg1P HM/5VD2jpeuI4A4eaSuNg+d1vExW0Pq7k2ZdC98Y= Date: Mon, 27 Apr 2026 08:12:13 -0700 From: Andrew Morton To: Catherine Cc: Muchun Song , Oscar Salvador , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/hugetlb: fix subpool accounting after cgroup charge failure Message-Id: <20260427081213.7935edd49d96622b08e81643@linux-foundation.org> In-Reply-To: <20260427145247.84157-2-enderaoelyther@gmail.com> References: <20260427145247.84157-2-enderaoelyther@gmail.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 27 Apr 2026 22:52:48 +0800 Catherine wrote: > alloc_hugetlb_folio() calls hugepage_subpool_get_pages() when map_chg > is set. For subpools with max_hpages, that increments used_hpages even > when the returned gbl_chg is positive. > > If a later hugetlb cgroup charge fails, the cleanup currently calls > hugepage_subpool_put_pages() only for !gbl_chg. The gbl_chg > 0 path > therefore leaks one used_hpages charge per failure. > > Always undo the subpool charge after a successful subpool get. Keep the > global reservation accounting under !gbl_chg, because only that path > consumed a reservation from the subpool. Thanks. We do prefer full, real names for kernel alterations. Can you please provide that?