• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021 The Android Open-Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15on init
16    # memory reserve tuning
17    write /proc/sys/vm/min_free_kbytes 27386
18    write /proc/sys/vm/lowmem_reserve_ratio "0 0 0"
19    # disable khugepaged
20    write /sys/kernel/mm/transparent_hugepage/enabled "never"
21
22# Property from experiments - server config
23on property:persist.device_config.vendor_system_native_boot.zram_size=*
24    setprop vendor.zram.size ${persist.device_config.vendor_system_native_boot.zram_size}
25
26# Property for local test. It can overwrite the server side config
27on property:sys.boot_completed=1 && property:persist.vendor.boot.zram.size=*
28    setprop vendor.zram.size ${persist.vendor.boot.zram.size}
29
30on property:sys.boot_completed=1
31    swapon_all /vendor/etc/fstab.zram.${vendor.zram.size}
32
33on property:sys.boot_completed=1
34    chmod 444 /sys/kernel/debug/page_owner
35
36    # Create mm_event trace point.
37    # For legacy devices, only mm_event is using this trace instance.
38    # Debugfs is only used in legacy devices and going to be deprecated.
39    # If others want to put more,it should get hard review from pixel-perf-team.
40    mkdir /sys/kernel/tracing/instances/pixel 0755 system system
41    chown system system /sys/kernel/tracing/instances/pixel/trace
42    chmod 0660 /sys/kernel/tracing/instances/pixel/trace
43    chown system system /sys/kernel/tracing/instances/pixel/tracing_on
44    chmod 0660 /sys/kernel/tracing/instances/pixel/tracing_on
45    write /sys/kernel/tracing/instances/pixel/buffer_size_kb 64
46    write /sys/kernel/tracing/instances/pixel/events/cma/cma_alloc_busy_retry/enable 1
47    write /sys/kernel/tracing/instances/pixel/events/cma/cma_alloc_start/enable 1
48    write /sys/kernel/tracing/instances/pixel/events/cma/cma_alloc_info/enable 1
49    write /sys/kernel/tracing/instances/pixel/events/cma/cma_release/enable 1
50    write /sys/kernel/tracing/instances/pixel/events/chunk_heap/enable 1
51    write /sys/kernel/tracing/instances/pixel/events/dmabuf_heap/dma_buf_release/enable 1
52    write /sys/kernel/tracing/instances/pixel/events/trusty/trusty_dma_buf_put/enable 1
53
54    # Allow max_usage_kb to be reset by system processes
55    chown system system /sys/kernel/vendor_mm/gcma_heap/trusty:faceauth_rawimage_heap/max_usage_kb
56    chmod 0660 /sys/kernel/vendor_mm/gcma_heap/trusty:faceauth_rawimage_heap/max_usage_kb
57
58# turns off tracing right before bugreporting to keep more traces
59on property:init.svc.dumpstatez=running
60    write /sys/kernel/tracing/instances/pixel/tracing_on 0
61
62on property:init.svc.dumpstatez=stopped
63    write /sys/kernel/tracing/instances/pixel/tracing_on 1
64
65on property:init.svc.bugreport=running
66    write /sys/kernel/tracing/instances/pixel/tracing_on 0
67
68on property:init.svc.bugreport=stopped
69    write /sys/kernel/tracing/instances/pixel/tracing_on 1
70
71on property:init.svc.bugreportd=running
72    write /sys/kernel/tracing/instances/pixel/tracing_on 0
73
74on property:init.svc.bugreportd=stopped
75    write /sys/kernel/tracing/instances/pixel/tracing_on 1
76
77# max-ram-size experiment
78service vendor.set_max_ram_size /vendor/bin/misc_writer --set-max-ram-size ${persist.device_config.vendor_system_native_boot.max_ram_size:--1}
79    disabled
80    oneshot
81
82on property:persist.device_config.vendor_system_native_boot.max_ram_size=*
83    start vendor.set_max_ram_size
84