1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# All memory configuration as following, which include ZRAM, LMK, RTCC,
# KSM, and some memory properties. The configurations parameters could
# auto-adaptive according to memory size.
# The Value of property ro.vendor.ramconfig should be {ro.boot.ddrssize} / 256, but if diff
# ro.boot.ddrsize use the same memory configuration parameters, the Value ro.vendor.ramconfig
# should be the same. such as 1024M, 1536M use the same configurations parameters.
#
# NOTE : IF Add new ro.vendor.ramconfig, PLEASE copy the configurations
#
# between BEGIN line and END line, Then change the parameters that you want.
# Table ro.boot.ddrsize mapping to ro.vendor.ramconfig
on property:ro.boot.ddrsize=1024M
setprop ro.vendor.ramconfig 4
on property:ro.boot.ddrsize=2048M
setprop ro.vendor.ramconfig 4
on property:ro.boot.ddrsize=3072M
setprop ro.vendor.ramconfig 12
on property:ro.boot.ddrsize=4096M
setprop ro.vendor.ramconfig 12
on property:ro.boot.ddrsize=6144M
setprop ro.vendor.ramconfig 12
on property:ro.boot.ddrsize=8192M
setprop ro.vendor.ramconfig 12
######## ramconfig=4,8 memory parameter configurations BEGIN #######
on property:ro.vendor.ramconfig=4
write /proc/sys/vm/watermark_scale_factor 10
#Set LMK watermark as {72M,90M,108M,126M,144M,180MB}
# setprop ro.vendor.lmk.adj "0,100,200,250,900,950"
# setprop ro.vendor.lmk.minfree "18432,23040,27648,32256,36864,46080"
# setprop ro.vendor.lmk.customize_minfree true
#Set ZRAM SIZE in blocks
export ZRAM_SIZE 15360
#Set zone_watermarks in zone
write /proc/sys/vm/min_free_kbytes 15360
######## ramconfig=4,8 memory parameter configurations END #########
######## ramconfig=12,16,24,32 memory parameter configurations BEGIN #######
on property:ro.vendor.ramconfig=12
write /proc/sys/vm/watermark_scale_factor 20
#Set LMK watermark as {108MB,135MB,162MB,189MB,324MB,472MB}
setprop ro.vendor.lmk.adj "0,100,200,250,900,950"
setprop ro.vendor.lmk.minfree "27648,34560,41472,48384,82944,120960"
setprop ro.vendor.lmk.customize_minfree true
#Set ZRAM SIZE in blocks
export ZRAM_SIZE 15360
######## ramconfig=12,16,24,32 memory parameter configurations END #########
#enable ZRAM
on property:sys.boot_completed=1
write /proc/sys/vm/swappiness 150
write /proc/sys/vm/page-cluster 0
write /sys/block/zram0/max_comp_streams 7
write /sys/block/zram0/comp_algorithm lz4
exec /system/bin/dd if=/dev/zero of=/data/per_boot/zram_swap bs=1024 count=ZRAM_SIZE
swapon_all /vendor/etc/fstab.enableswap
#Set vmpressure based process reclaim
# write /sys/module/process_reclaim/parameters/pressure_min 50
# write /sys/module/process_reclaim/parameters/pressure_max 90
# write /sys/module/process_reclaim/parameters/min_score_adj 360
# write /sys/module/process_reclaim/parameters/per_swap_size 1024
# write /sys/module/process_reclaim/parameters/swap_opt_eff 50
# write /sys/module/process_reclaim/parameters/swap_eff_win 2
# write /sys/module/process_reclaim/parameters/swap_low_ratio 65
# write /sys/module/process_reclaim/parameters/swap_high_ratio 85
write /sys/module/process_reclaim/parameters/enable_process_reclaim 1
#Set direct_swappiness
write /proc/sys/vm/direct_swappiness 100
#Enable enhance meminfo
# write sys/module/emem/parameters/killed_proc_adj_threshold 200
write sys/module/emem/parameters/enable 1
# system group cannot write to /proc/sys files,
# and chown/chmod does not work for /proc/sys/ entries.
# So proxy writes through init.
on property:sys.trigger_emem.oomadj=*
write /proc/sys/vm/emem_trigger ${sys.trigger_emem.oomadj}
|