mm: remove references to folio in __memcg_kmem_uncharge_page()

This use of folios is misleading because these pages are not part of
a folio.  Remove an unnecessary call to page_folio(), saving 58 bytes
of text in a Debian kernel build.

Link: https://lkml.kernel.org/r/20250314133617.138071-6-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Cc: David Hildenbrand <david@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2025-03-14 13:36:15 +00:00 committed by Andrew Morton
parent 8492936abb
commit 0d2a260523

View File

@ -2726,16 +2726,14 @@ int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order)
*/
void __memcg_kmem_uncharge_page(struct page *page, int order)
{
struct folio *folio = page_folio(page);
struct obj_cgroup *objcg;
struct obj_cgroup *objcg = page_objcg(page);
unsigned int nr_pages = 1 << order;
if (!folio_memcg_kmem(folio))
if (!objcg)
return;
objcg = __folio_objcg(folio);
obj_cgroup_uncharge_pages(objcg, nr_pages);
folio->memcg_data = 0;
page->memcg_data = 0;
obj_cgroup_put(objcg);
}