| #!/bin/sh |
| |
| # These changes are initially in /init provided by QCA. |
| # The reason for the move is to leave the triggering to |
| # the end of system booting (/init to qca, and this script to windcharger). |
| # Some tunings are made: |
| # 1. inode/dentry reclaiming is more aggresive. |
| # 2. dirty pages (jffs2 for /config) writing back is more aggresive. |
| |
| # Dentry/inode uses a lot memory, give them pressure. |
| echo 1000 > /proc/sys/vm/vfs_cache_pressure |
| |
| # when processes uses page-cache more than 20% of system memory, |
| # lets force them to write |
| echo 20 > /proc/sys/vm/dirty_ratio |
| |
| # when the dirty pages cross more than 5% of sys memory |
| # kick in the pdflush |
| echo 5 > /proc/sys/vm/dirty_background_ratio |
| |
| # Reduce block read ahead from 2**3=8 to 2**0=1. |
| # This number control # of blocks to read for each page fault, it's 3 by default |
| # in 3.3.8, and set it to read only page faulted page. One reason is to reduce |
| # footprint, another reason is that most our rootfs files are small. It may |
| # sacrifice performace some how by reducing memory usage. |
| echo 0 > /proc/sys/vm/page-cluster |
| |
| case "$1" in |
| start) |
| babysit 60 memopt 2>&1 | logos memopt & |
| ;; |
| stop) |
| pkillwait -f memopt |
| ;; |
| restart) |
| $0 stop; $0 start |
| ;; |
| *) |
| echo "Usage: $0 {start|stop|restart}" |
| exit 1 |
| esac |