]> www.infradead.org Git - users/jedix/linux-maple.git/commit
memcg: Use trylock to access memcg stock_lock.
authorAlexei Starovoitov <ast@kernel.org>
Sat, 22 Feb 2025 02:44:25 +0000 (18:44 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 27 Feb 2025 17:39:37 +0000 (09:39 -0800)
commit01d37228d331047a0bbbd1026cec2ccabef6d88d
tree58cfefa3193c51ac16632143f9786d868a601f92
parent8c57b687e8331eb80e302a2c528b18b966a9ac7a
memcg: Use trylock to access memcg stock_lock.

Teach memcg to operate under trylock conditions when spinning locks
cannot be used.

localtry_trylock might fail and this would lead to charge cache bypass
if the calling context doesn't allow spinning (gfpflags_allow_spinning).
In those cases charge the memcg counter directly and fail early if
that is not possible. This might cause a pre-mature charge failing
but it will allow an opportunistic charging that is safe from
try_alloc_pages path.

Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20250222024427.30294-5-alexei.starovoitov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
mm/memcontrol.c