Skip to content

Commit 3dc30ef

Browse files
shakeelbakpm00
authored andcommitted
memcg: bypass root memcg check for skmem charging
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>
1 parent f7b0797 commit 3dc30ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memcontrol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4881,7 +4881,7 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages,
48814881
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
48824882
return memcg1_charge_skmem(memcg, nr_pages, gfp_mask);
48834883

4884-
if (try_charge(memcg, gfp_mask, nr_pages) == 0) {
4884+
if (try_charge_memcg(memcg, gfp_mask, nr_pages) == 0) {
48854885
mod_memcg_state(memcg, MEMCG_SOCK, nr_pages);
48864886
return true;
48874887
}

0 commit comments

Comments
 (0)