[Devel] [PATCH RHEL7 COMMIT] mm/memcg: do not save call stacks of css_get/put by default

Vasily Averin vvs at virtuozzo.com
Sat Jul 3 10:25:55 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.31.1.vz7.181.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.31.1.vz7.181.9
------>
commit baa4127a741b9f0bd97093a50dab57198d7dd41b
Author: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
Date:   Sat Jul 3 10:25:55 2021 +0300

    mm/memcg: do not save call stacks of css_get/put by default
    
    Commit f0c5834e75fc ("mm/memcg: save css_get/put stacks") left saving of
    call stacks for css_get/put operations enabled by default. As it turned
    out, it caused about 10% performance loss in the use cases where
    such operations with memcg happened often (see PSBM-131085). If such css
    debugging was turned off, the performance regression disappeared.
    
    Let us keep saving of stacks for css operations off by default. If
    needed, it can be enabled in runtime:
      echo 1 > /sys/kernel/debug/css_stacks
    
    While at it, I replaced "no_css_stacks" boot option with "css_stacks=",
    which accepts 0/1/on/off/... (see the description of kstrtobool()) and
    allows the user to enable or disable this debugging feature at boot
    time. This way, even if we decide to flip the defaults again in the
    future, the boot option would still be usable.
    
    https://jira.sw.ru/browse/PSBM-131085
    Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
 kernel/cgroup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b6408e6..9d360a0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4512,7 +4512,7 @@ static int css_stacks_set(void *data, u64 val)
 DEFINE_SIMPLE_ATTRIBUTE(css_stacks_fops,
 		css_stacks_get, css_stacks_set, "%llu\n");
 
-int setup_css_stacks_cmd = 1;
+bool setup_css_stacks_cmd;
 static int __init css_stacks_debugfs(void)
 {
 	void *ret;
@@ -4529,10 +4529,9 @@ late_initcall(css_stacks_debugfs);
 
 static int __init setup_css_stacks(char *str)
 {
-	setup_css_stacks_cmd = 0;
-	return 1;
+	return (kstrtobool(str, &setup_css_stacks_cmd) == 0);
 }
-__setup("no_css_stacks", setup_css_stacks);
+__setup("css_stacks=", setup_css_stacks);
 #endif
 
 static void init_cgroup_css(struct cgroup_subsys_state *css,


More information about the Devel mailing list