Commit 3ae8e2f1 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan
Browse files

BACKPORT: FROMLIST: mm, memcg: inline mem_cgroup_{charge/uncharge} to improve disabled memcg config

Inline mem_cgroup_{charge/uncharge} and mem_cgroup_uncharge_list functions
functions to perform mem_cgroup_disabled static key check inline before
calling the main body of the function. This minimizes the memcg overhead
in the pagefault and exit_mmap paths when memcgs are disabled using
cgroup_disable=memory command-line option.
This change results in ~0.4% overhead reduction when running PFT test [1]
comparing {CONFIG_MEMCG=n} against {CONFIG_MEMCG=y, cgroup_disable=memory}
configuration on an 8-core ARM64 Android device.

[1] https://lkml.org/lkml/2006/8/29/294

 also used in mmtests suite

Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>

Conflicts:
        include/linux/memcontrol.h
        mm/memcontrol.c

1. Trivial merge conflicts in memcontrol.h
2. Did not need to rename __mem_cgroup_charge into memcg_charge as in the
upstream version since in 5.10 __mem_cgroup_charge did not exist

Link: https://lore.kernel.org/patchwork/patch/1458907/


Bug: 191223209
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
Change-Id: I9aad72aeabec2fe01f7218d629ec545c47b5d2c3
parent f73d0294
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment