From 4f0da7cb8256bd7038e16e573e1a6c259e04b0a3 Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Fri, 29 Jun 2018 14:52:47 -0700 Subject: [PATCH] Add debug system properties to control profiling limits. When security.perf_harden is disabled through adb, use some debug system properties to set profiling limits in the kernel, including cpu percentage, memory, and max sample rate. Bug: 110706031 Test: boot hikey960 and manually set system properties to make Test: sure it works. Change-Id: I44c0adf3a000bb393905233f2a097c97b5fe91ec --- rootdir/init.rc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rootdir/init.rc b/rootdir/init.rc index 625ffba08..c1ae93283 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -718,6 +718,9 @@ on property:sys.sysctl.tcp_def_init_rwnd=* on property:security.perf_harden=0 write /proc/sys/kernel/perf_event_paranoid 1 + write /proc/sys/kernel/perf_event_max_sample_rate ${debug.perf_event_max_sample_rate:-100000} + write /proc/sys/kernel/perf_cpu_time_max_percent ${debug.perf_cpu_time_max_percent:-25} + write /proc/sys/kernel/perf_event_mlock_kb ${debug.perf_event_mlock_kb:-516} on property:security.perf_harden=1 write /proc/sys/kernel/perf_event_paranoid 3