]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
memcg: bypass root memcg check for skmem charging
authorShakeel Butt <shakeel.butt@linux.dev>
Fri, 28 Feb 2025 02:23:54 +0000 (18:23 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:51 +0000 (21:50 -0800)
The root memcg is never associated with a socket in mem_cgroup_sk_alloc,
so there is no need to check if the given memcg is root for the skmem
charging code path.

Link: https://lkml.kernel.org/r/20250228022354.2624249-1-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin (Cruise) <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c

index 0f5e55e75dc9490bf682b2bcf6afb4492b36783b..efa14e776ecb3dbaac1a55102c5fd20e247518db 100644 (file)
@@ -4888,7 +4888,7 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages,
        if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
                return memcg1_charge_skmem(memcg, nr_pages, gfp_mask);
 
-       if (try_charge(memcg, gfp_mask, nr_pages) == 0) {
+       if (try_charge_memcg(memcg, gfp_mask, nr_pages) == 0) {
                mod_memcg_state(memcg, MEMCG_SOCK, nr_pages);
                return true;
        }