본문 바로가기

Linux/Android

Android 시스템 트윅? init.rc에 적용


각 항목이 뭘하는 걸까요?

Android 시스템 트윅? init.rc에 적용

# Increase readahead buffers on MMC devices
echo "2048" > /sys/block/mmcblk0/bdi/read_ahead_kb;
echo "2048" > /sys/block/mmcblk1/bdi/read_ahead_kb;

# microSD card speed tweak
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;

# Battery
echo "500" > /proc/sys/vm/dirty_expire_centisecs;
echo "1000" > /proc/sys/vm/dirty_writeback_centisecs;

# ram tweak
echo "0,1,2,4,7,14" > /sys/module/lowmemorykiller/parameters/adj;

# Minfree tweaks
echo "3072,4608,7200,20480,32768,65536" > /sys/module/lowmemorykiller/parameters/minfree;

# misc kernel tweaks
echo "0" > /proc/sys/kernel/hung_task_timeout_secs;
echo "0" > /proc/sys/kernel/tainted;
echo "0" > /proc/sys/kernel/panic_on_oops;
echo "0" > /proc/sys/kernel/sched_child_runs_first;
echo "1" > /proc/sys/kernel/sched_compat_yield;
echo "1" > /proc/sys/kernel/panic;
echo "5000" > /proc/sys/kernel/threads-max;
echo "64000" > /proc/sys/kernel/msgmni;
echo "64000" > /proc/sys/kernel/msgmax;
echo "100000" > /proc/sys/kernel/sched_rt_period_us;
echo "256000" > /proc/sys/kernel/sched_shares_ratelimit;
echo "400000" > /proc/sys/kernel/sched_min_granularity_ns;
echo "400000" > /proc/sys/kernel/sched_wakeup_granularity_ns;
echo "600000" > /proc/sys/kernel/sched_latency_ns;
echo "950000" > /proc/sys/kernel/sched_rt_runtime_us;
echo "268435456" > /proc/sys/kernel/shmmax;
echo "500,512000,64,2048" > /proc/sys/kernel/sem;

# vm management tweaks
echo "0" > /proc/sys/vm/drop_caches;
echo "0" > /proc/sys/vm/overcommit_ratio;
echo "0" > /proc/sys/vm/page-cluster;
echo "0" > /proc/sys/vm/oom_kill_allocating_task;
echo "0" > /proc/sys/vm/panic_on_oom;
echo "0" > /proc/sys/vm/laptop_mode;
echo "0" > /proc/sys/vm/swappiness;
echo "0" > /proc/sys/vm/overcommit_memory;
echo "10" > /proc/sys/vm/vfs_cache_pressure;
echo "15" > /proc/sys/vm/dirty_ratio;
echo "10" > /proc/sys/vm/dirty_background_ratio;

# Disable normalize sleeper (Other kernel tweaks)
mount -t debugfs none /sys/kernel/debug
echo "NO_NORMALIZED_SLEEPER" > /sys/kernel/debug/sched_features
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features
umount /sys/kernel/debug

# internet speed tweaks
echo "256960" > /proc/sys/net/core/wmem_default;
echo "256960" > /proc/sys/net/core/rmem_default;
echo "1048576" > /proc/sys/net/core/wmem_max;
echo "1048576" > /proc/sys/net/core/rmem_max;
echo "700" > /proc/sys/net/core/netdev_max_backlog;
echo "5120" > /proc/sys/net/core/optmem_max;
echo "0" > /proc/sys/net/ipv4/tcp_timestamps;
echo "0" > /proc/sys/net/ipv4/conf/default/accept_source_route;
echo "1" > /proc/sys/net/ipv4/ip_forward;
echo "1" > /proc/sys/net/ipv4/tcp_syn_retries;
echo "1" > /proc/sys/net/ipv4/tcp_tw_reuse;
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling;
echo "1" > /proc/sys/net/ipv4/tcp_sack;
echo "1" > /proc/sys/net/ipv4/tcp_rfc1337;
echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save;
echo "1" > /proc/sys/net/ipv4/tcp_synack_retries;
echo "1" > /proc/sys/net/ipv4/tcp_tw_recycle;
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts;
echo "1" > /proc/sys/net/ipv4/conf/all/arp_filter;
echo "1" > /proc/sys/net/ipv4/conf/default/arp_filter;
echo "1" > /proc/sys/net/ipv4/conf/lo/rp_filter;
echo "1" > /proc/sys/net/ipv4/conf/default/rp_filter;
echo "1" > /proc/sys/net/ipv4/tcp_dsack;
echo "1" > /proc/sys/net/ipv4/tcp_moderate_rcvbuf;
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses;
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all;
echo "5" > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo "15" > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo "15" > /proc/sys/net/ipv4/tcp_fin_timeout;
echo "64" > /proc/sys/net/ipv4/ip_default_ttl;
echo "1800" > /proc/sys/net/ipv4/tcp_keepalive_time;
echo "2500" > /proc/sys/net/ipv4/tcp_max_syn_backlog;
echo "4096" > /proc/sys/net/ipv4/udp_rmem_min;
echo "4096" > /proc/sys/net/ipv4/udp_wmem_min;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_wmem;
echo "4096,87380,404480" > /proc/sys/net/ipv4/tcp_rmem;
echo "0" > /proc/sys/net/ipv6/bindv6only;
echo "10" > /proc/sys/net/ipv6/mld_max_msf;
echo "60" > /proc/sys/net/ipv6/ip6frag_time;
echo "600" > /proc/sys/net/ipv6/ip6frag_secret_interval;
echo "196608" > /proc/sys/net/ipv6/ip6frag_low_thresh;
echo "262144" > /proc/sys/net/ipv6/ip6frag_high_thresh;