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 4B844221FB4; Tue, 21 Jul 2026 02:53:09 +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=1784602389; cv=none; b=DuxCd+r2LouCqBRscS6JR1n5RZO/c3BHRpQ0d2BVjvZSfw80G69FPS4h2KgsewrtLC6GR9xux0PqND9B0JVrGR7d1LY5S+lmKmgCkQwQERDtxt1CT+95zpi9ccy+tyGEwRsf+5INGOtQYRjkx4V0UfBt9lTllQMl1MC4AJS0k+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784602389; c=relaxed/simple; bh=Us68nlmiczQXSuV6e/jQLLsnNhiOlkPZQjCHR8+MEVg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pfb3KdQ+6N1m9GLOqOc481OO4blHcFEWAJqRi0O0VBCJpuICjdI1JiHvqAWU0HBh0rn0KvpLrhQ7v9Ay57JLjQhRPrdnVwXVJQ9gxXjjjv7TnQpzAesuZbyD4SG+V0qmE5ysGTldrTyw2PzwrUW4jJkfjWededFIVT3bhWVPSz4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gKJMT4Hu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gKJMT4Hu" Received: by smtp.kernel.org (Postfix) with ESMTPS id 110A4C2BCFB; Tue, 21 Jul 2026 02:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1784602389; bh=Us68nlmiczQXSuV6e/jQLLsnNhiOlkPZQjCHR8+MEVg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gKJMT4HuK026T3JHk7a9omtQ18OWp7GnSYZ76oYiGMUHyN/YdDGNNMYhGuVVLq99T qwlx0+DbEt+sMM7NZbLbAt9/O3iqNz4Ww/SdV+yYeA5n1sgHapjwFPQRWzD5hIz8gt k83Rew8CVsBVlBKrkMEYTm1H3mb5sU2Cc8CvsFGV+d9RlXFpOEwFlGLUnheMPenPZ8 GXqkLWZSqbMTO7eXkIWGNAfzJxFsb1rzAEpVi4iywlm3zXttdHTptmhK2dS8uUQHWM oh17kGa0Pnr1DXUiiZKfE5+QXpQpC8nsihL8pMAN6bYUFTDt0p3m8t0VHabtieI0l1 5cmNKkWJOJ8Ww== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id F29B3C44532; Tue, 21 Jul 2026 02:53:08 +0000 (UTC) From: Ackerley Tng via B4 Relay Date: Mon, 20 Jul 2026 17:25:07 -0700 Subject: [PATCH v3 04/13] mm: hugetlb: Remove unused mem_cgroup_charge_hugetlb function Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260720-hugetlb-alloc-failure-fixes-v3-4-7d2a169aa9ee@google.com> References: <20260720-hugetlb-alloc-failure-fixes-v3-0-7d2a169aa9ee@google.com> In-Reply-To: <20260720-hugetlb-alloc-failure-fixes-v3-0-7d2a169aa9ee@google.com> To: Muchun Song , Oscar Salvador , David Hildenbrand , Joshua Hahn , Shakeel Butt , Nhat Pham , Andrew Morton , Peter Xu , Wupeng Ma , fvdl@google.com, rientjes@google.com, jthoughton@google.com, Mike Kravetz , Johannes Weiner , Michal Hocko , Roman Gushchin Cc: vannapurve@google.com, erdemaktas@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Ackerley Tng X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784602387; l=2906; i=ackerleytng@google.com; s=20260225; h=from:subject:message-id; bh=YxYG1OGXEwJP8y6Z/IuFu/IygfIhB7TL//GqeViUvNo=; b=ODtz7IxzrmEVm8ITYNPhXWX2tkSFDb0Wo55iHcQRNwKOI1rX9vcyL7wqj2XEfXYcaIBA0galC iwpBY5zcPvkCL3uWuHWuJCKXlOZCeXKd8EuisExKDwVIE1ZR8hjkV60 X-Developer-Key: i=ackerleytng@google.com; a=ed25519; pk=sAZDYXdm6Iz8FHitpHeFlCMXwabodTm7p8/3/8xUxuU= X-Endpoint-Received: by B4 Relay for ackerleytng@google.com/20260225 with auth_id=649 X-Original-From: Ackerley Tng Reply-To: ackerleytng@google.com From: Ackerley Tng Now that the alloc_hugetlb_folio path has been successfully migrated to the new try-commit-cancel memcg charging protocol, the old mem_cgroup_charge_hugetlb function and its associated header and static inline declarations are completely unused. Remove them to clean up the memory controller's codebase. Signed-off-by: Ackerley Tng --- include/linux/memcontrol.h | 6 ------ mm/memcontrol.c | 34 ---------------------------------- 2 files changed, 40 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index c4e63d0e03526..23fbbbc8e11f2 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -641,7 +641,6 @@ static inline int mem_cgroup_charge(struct folio *folio, struct mm_struct *mm, return __mem_cgroup_charge(folio, mm, gfp); } -int mem_cgroup_charge_hugetlb(struct folio *folio, gfp_t gfp); int mem_cgroup_hugetlb_try_charge(unsigned int nr_pages, gfp_t gfp, struct mem_cgroup **memcg_p, struct obj_cgroup **objcg_p); @@ -1137,11 +1136,6 @@ static inline int mem_cgroup_charge(struct folio *folio, return 0; } -static inline int mem_cgroup_charge_hugetlb(struct folio *folio, gfp_t gfp) -{ - return 0; -} - static inline int mem_cgroup_hugetlb_try_charge(unsigned int nr_pages, gfp_t gfp, struct mem_cgroup **memcg_p, struct obj_cgroup **objcg_p) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 0beee5c0ce93b..6764ff041c196 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5146,40 +5146,6 @@ int __mem_cgroup_charge(struct folio *folio, struct mm_struct *mm, gfp_t gfp) return ret; } -/** - * mem_cgroup_charge_hugetlb - charge the memcg for a hugetlb folio - * @folio: folio being charged - * @gfp: reclaim mode - * - * This function is called when allocating a huge page folio, after the page has - * already been obtained and charged to the appropriate hugetlb cgroup - * controller (if it is enabled). - * - * Returns ENOMEM if the memcg is already full. - * Returns 0 if either the charge was successful, or if we skip the charging. - */ -int mem_cgroup_charge_hugetlb(struct folio *folio, gfp_t gfp) -{ - struct mem_cgroup *memcg = get_mem_cgroup_from_current(); - int ret = 0; - - /* - * Even memcg does not account for hugetlb, we still want to update - * system-level stats via lruvec_stat_mod_folio. Return 0, and skip - * charging the memcg. - */ - if (mem_cgroup_disabled() || !memcg_accounts_hugetlb() || - !memcg || !cgroup_subsys_on_dfl(memory_cgrp_subsys)) - goto out; - - if (charge_memcg(folio, memcg, gfp)) - ret = -ENOMEM; - -out: - mem_cgroup_put(memcg); - return ret; -} - /** * mem_cgroup_hugetlb_try_charge - Try to charge the memcg for a hugetlb folio * @nr_pages: number of base pages to charge -- 2.55.0.229.g6434b31f56-goog