]> www.infradead.org Git - users/willy/linux.git/commitdiff
mm: simplify folio_memcg_charged()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 14 Mar 2025 13:36:14 +0000 (13:36 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 22 Mar 2025 05:03:12 +0000 (22:03 -0700)
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.

Link: https://lkml.kernel.org/r/20250314133617.138071-5-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>
include/linux/memcontrol.h

index ea28cacfb0d266be2c8753ac1daabe7b5d4f4cae..53364526d87756ad0e31fa20894eb5d843aa5784 100644 (file)
@@ -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;
 }
 
 /*