diff mbox series

[v2,4/5] mm: Simplify folio_memcg_charged()

Message ID 20250314133617.138071-5-willy@infradead.org (mailing list archive)
State New
Headers show
Series Minor memcg cleanups & prep for memdescs | expand

Commit Message

Matthew Wilcox March 14, 2025, 1:36 p.m. UTC
There's no need to check which kind of pointer is in the memcg_data
field, all we actually care about is whether it's zero or not.
Saves 70 bytes in workingset_activation() with the Debian config.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
---
 include/linux/memcontrol.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index ea28cacfb0d2..53364526d877 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -438,9 +438,7 @@  static inline struct mem_cgroup *folio_memcg(struct folio *folio)
  */
 static inline bool folio_memcg_charged(struct folio *folio)
 {
-	if (folio_memcg_kmem(folio))
-		return __folio_objcg(folio) != NULL;
-	return __folio_memcg(folio) != NULL;
+	return folio->memcg_data != 0;
 }
 
 /*