]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: memcg: don't call propagate_protected_usage() needlessly
authorRoman Gushchin <roman.gushchin@linux.dev>
Fri, 26 Jul 2024 20:31:08 +0000 (20:31 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:52:36 +0000 (17:52 -0700)
commitf5ce322ddfd86303e9adfb0788969033f75ef9d6
treebea5e52a5373aec0eb52b045e2131811e3fd8f50
parent23571ae794f484c25b338f9519d53598ff6efc1e
mm: memcg: don't call propagate_protected_usage() needlessly

Patch series "mm: memcg: page counters optimizations", v3.

This patchset contains 3 independent small optimizations of page counters.

This patch (of 3):

Memory protection (min/low) requires a constant tracking of protected
memory usage.  propagate_protected_usage() is called on each page counters
update and does a number of operations even in cases when the actual
memory protection functionality is not supported (e.g.  hugetlb cgroups or
memcg swap counters).

It's obviously inefficient and leads to a waste of CPU cycles.  It can be
addressed by calling propagate_protected_usage() only for the counters
which do support memory guarantees.  As of now it's only memcg->memory -
the unified memory memcg counter.

Link: https://lkml.kernel.org/r/20240726203110.1577216-2-roman.gushchin@linux.dev
Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/page_counter.h
mm/hugetlb_cgroup.c
mm/memcontrol.c
mm/page_counter.c