[HTC Sensation] GabrielSousa:
hello,

i been testing some options, to speed up our sensation.

i had great results on android 2.3.4 (sense 3.0)

not so great on android 2.3.5, on bench tests, but on UI i cant tell the difference.

if you can improve this, be my guest ;)

opinions are welcome

GOOD PERFORMANCE AND GOOD BATTERY LIFE

#!/system/bin/sh

echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 5 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 100000 > /proc/sys/kernel/sched_rt_period_us
echo 95000 > /proc/sys/kernel/sched_rt_runtime_us

echo 0 > /proc/sys/vm/swappiness
echo 10 > /proc/sys/vm/dirty_ratio
echo 4 > /proc/sys/vm/dirty_background_ratio
echo 4096 > /proc/sys/vm/min_free_kbytes
echo 5 > /proc/sys/vm/vfs_cache_pressure
echo 0 > /proc/sys/vm/oom_kill_allocating_task
echo 0 > /proc/sys/vm/laptop_mode
echo 0 > /proc/sys/vm/panic_on_oom
echo 0 > /proc/sys/kernel/tainted
echo 3 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/page-cluster

echo 10 > /proc/sys/fs/lease-break-time

echo 1 > /proc/sys/vm/overcommit_memory
echo 100 > /proc/sys/vm/overcommit_ratio

echo 500 > /proc/sys/vm/dirty_expire_centisecs
echo 1000 > /proc/sys/vm/dirty_writeback_centisecs

echo 10000000 > /proc/sys/kernel/sched_latency_ns
echo 0 > /proc/sys/kernel/sched_wakeup_granularity_ns
echo 2000000 > /proc/sys/kernel/sched_min_granularity_ns
echo 725000 > /proc/sys/kernel/sched_shares_ratelimit

MAXIMUM PERFORMANCE

#!/system/bin/sh

echo 20000 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate
echo 60 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
echo 5 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
echo 100000 > /proc/sys/kernel/sched_rt_period_us
echo 95000 > /proc/sys/kernel/sched_rt_runtime_us

echo 0 > /proc/sys/vm/swappiness
echo 10 > /proc/sys/vm/dirty_ratio
echo 4 > /proc/sys/vm/dirty_background_ratio
echo 4096 > /proc/sys/vm/min_free_kbytes
echo 5 > /proc/sys/vm/vfs_cache_pressure
echo 0 > /proc/sys/vm/oom_kill_allocating_task
echo 0 > /proc/sys/vm/laptop_mode
echo 0 > /proc/sys/vm/panic_on_oom
echo 0 > /proc/sys/kernel/tainted
echo 3 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/page-cluster

echo 10 > /proc/sys/fs/lease-break-time

echo 1 > /proc/sys/vm/overcommit_memory
echo 100 > /proc/sys/vm/overcommit_ratio

echo 200 > /proc/sys/vm/dirty_expire_centisecs
echo 500 > /proc/sys/vm/dirty_writeback_centisecs

echo 10000000 > /proc/sys/kernel/sched_latency_ns
echo 0 > /proc/sys/kernel/sched_wakeup_granularity_ns
echo 2000000 > /proc/sys/kernel/sched_min_granularity_ns
echo 725000 > /proc/sys/kernel/sched_shares_ratelimit

EDIT:14-10-2011

added "echo 10 > /proc/sys/fs/lease-break-time"

EDIT:08-10-2011

change "echo 1000000 > /proc/sys/kernel/sched_latency_ns" to "echo 10000000 > /proc/sys/kernel/sched_latency_ns"

change "echo 100000 > /proc/sys/kernel/sched_min_granularity_ns" to "echo 2000000 > /proc/sys/kernel/sched_min_granularity_ns"

MAN

[SIZE="3"][U]sampling_down_factor[/U]:

this parameter controls the rate at which the
kernel makes a decision on when to decrease the frequency while running
at top speed. When set to 1 (the default) decisions to reevaluate load
are made at the same interval regardless of current clock speed. But
when set to greater than 1 (e.g. 100) it acts as a multiplier for the
scheduling interval for reevaluating load when the CPU is at its top
speed due to high load. This improves performance by reducing the overhead
of load evaluation and helping the CPU stay at its top speed when truly
busy, rather than shifting back and forth in speed. This tunable has no
effect on behavior at lower speeds/lower CPU loads.

sampling_down_factor merge time
1 (default) 1 minute and 59 seconds.
20 1 minute and 47 seconds.
100 1 minute and 29 seconds.
150 1 minute and 24 seconds.
200 1 minute and 22 seconds.
300 1 minute and 20 seconds.
500 1 minute and 12 seconds.
1500 1 minute and 7 seconds.[/SIZE]

[SIZE="3"]
[U]swappiness[/U]:

parameter controls the tendency of the kernel to move processes out of
hysical memory and onto the swap disk. Because disks are much slower than
RAM, this can lead to slower response times for system and applications if
rocesses are too aggressively moved out of memory.

swappiness can have a value of between 0 and 100

swappiness=0 tells the kernel to avoid swapping processes out of physical
memory for as long as possible

swappiness=100 tells the kernel to aggressively swap processes out of
physical memory and move them to swap cache

[/SIZE]

[SIZE="3"]
[U]dirty_ratio[/U]:

Contains, as a percentage of total system memory,
the number of pages at which a process which is generating
disk writes will itself start writing out dirty data.

Lower the amount of unwritten write cache to reduce lags
when a huge write is required

[SIZE="2"][I][COLOR="Red"]Lower the amount of unwritten write cache to reduce lags when a huge write is required.[/COLOR][/I][/SIZE]
[/SIZE]

[SIZE="3"]
[U]sched_rt_period_us[/U]: (Real-Time group scheduling)

The scheduling period that is equivalent to 100% CPU bandwidth[/SIZE]

[SIZE="3"]
[U]
sched_rt_runtime_us[/U]: (Real-Time group scheduling)

A global limit on how much time realtime scheduling may use. Even without
CONFIG_RT_GROUP_SCHED enabled, this will limit time reserved to realtime
processes. With CONFIG_RT_GROUP_SCHED it signifies the total bandwidth
available to all realtime groups.

* Time is specified in us because the interface is s32. This gives an
operating range from 1us to about 35 minutes.
* sched_rt_period_us takes values from 1 to INT_MAX.
* sched_rt_runtime_us takes values from -1 to (INT_MAX - 1).
* A run time of -1 specifies runtime == period, ie. no limit.[/SIZE]

[SIZE="3"]
[U]laptop_mode[/U]:

When laptop mode is enabled, the Linux will try to be smart about when
to do disk I/O. It gives as much time as possible to be in a low
power state.
If mode is disabled if value is set to zero (0). To enable mode use non
zero value such as 5.
[/SIZE]

[SIZE="3"]
[U]oom_kill_allocating_task[/U]:

This enables or disables killing the OOM-triggering task in
out-of-memory situations.

If this is set to zero, the OOM killer will scan through the entire tasklist
and select a task based on heuristics to kill. This normally selects a
rogue memory-hogging task that frees up a large amount of memory
when killed.

If this is set to non-zero, the OOM killer simply kills the task that
triggered the out-of-memory condition. This avoids the expensive tasklist
scan.

If panic_on_oom is selected, it takes precedence over whatever value is
used in oom_kill_allocating_task.

The default value is 0.
[/SIZE]

[SIZE="3"]
[U]panic_on_oom[/U]:

This enables or disables panic on out-of-memory feature.

1 the kernel panics when out-of-memory happens.
0 the kernel will kill some rogue process, by calling oom_kill().

Usually, oom_killer can kill rogue processes and system will survive.
If you want to panic the system rather than killing rogue processes, set
this to 1.

The default value is 0.
[/SIZE]

[SIZE="3"]
[U]drop_caches[/U]:

Will cause the kernel to drop clean caches, dentries and inodes from
memory, causing that memory to become free.

1 to free pagecache
2 to free dentries and inodes
3 to free pagecache, dentries and inodes

As this is a non-destructive operation, and dirty objects are not
freeable, the user should run "sync" first in order to make sure all
cached objects are freed.

[/SIZE]

[SIZE="3"]
[U]vfs_cache_pressure[/U]:

Controls the tendency of the kernel to reclaim the memory which is used for
caching of directory and inode objects.

At the default value of vfs_cache_pressure = 100 the kernel will attempt
to reclaim dentries and inodes at a "fair" rate with respect to pagecache
and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel
to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure
beyond 100 causes the kernel to prefer to reclaim dentries and inodes.

[/SIZE]

[SIZE="3"]
[U]page-cluster[/U]:

controls the number of pages which are written to swap in a single attempt.
The swap I/O size.

It is a logarithmic value
0 means "1 page"
1 means "2 pages"
2 means "4 pages"
3 means "8 pages"

The default value is three (eight pages at a time).
There may be some small benefits in tuning this to a different value
if your workload is swap-intensive.

[/SIZE]

[SIZE="3"]
[U]min_free_kbytes[/U]:

This is used to force the Linux VM to keep a minimum number of kilobytes
free. The VM uses this number to compute a pages_min value for each
lowmem zone in the system. Each lowmem zone gets a number of reserved
free pages based proportionally on its size

[SIZE="2"][I][COLOR="Red"]Increase minimum free memory, in theory this should make the kernel less likely to
suddenly run out of memory[/COLOR][/I][/SIZE]
[/SIZE]

[SIZE="3"]
[U]overcommit_memory[/U]:

Controls overcommit of system memory, possibly allowing processes to
allocate (but not use) more memory than is actually available.

0 Heuristic overcommit handling. Obvious overcommits of
address space are refused. Used for a typical system.
It ensures a seriously wild allocation fails while allowing
overcommit to reduce swap usage. root is allowed to allocate
slighly more memory in this mode. This is the default.
1 Always overcommit. Appropriate for some scientific applications.
2 Don't overcommit. The total address space commit for the system
is not permitted to exceed swap plus a configurable percentage
(default is 50) of physical RAM. Depending on the percentage
you use, in most situations this means a process will not be
killed while attempting to use already-allocated memory but
will receive errors on memory allocation as appropriate.

[/SIZE]

[SIZE="3"]
[U]overcommit_ratio[/U]:

Percentage of physical memory size to include in overcommit calculations.

Memory allocation limit = swapspace + physmem * (overcommit_ratio / 100)

swapspace = total size of all swap areas
physmem = size of physical memory in system

[/SIZE]

[SIZE="3"]
[U]dirty_expire_centisecs[/U]:

This tunable is used to define when dirty data is old enough to be
eligible for writeout by the pdflush daemons. It is expressed in 100'ths
of a second. Data which has been dirty in memory for longer than this
interval will be written out next time a pdflush daemon wakes up.

[/SIZE]

[SIZE="3"]
[U]dirty_writeback_centisecs[/U]:

The pdflush writeback daemons will periodically wake up and write "old"
data out to disk. This tunable expresses the interval between those
wakeups, in 100'ths of a second.

Setting this to zero disables periodic writeback altogether.

[/SIZE]

[SIZE="3"]
[U]dirty_background_ratio[/U]:

Contains, as a percentage of total system memory, the number of pages
at which the pdflush background writeback daemon will start writing
out dirty data.

[/SIZE]

[SIZE="3"]
[U]tainted[/U]:

Non-zero if the kernel has been tainted. Numeric values, which can
be ORed together:

1 a module with a non-GPL license has been loaded, this includes
modules with no license (set by modutils and module-init-tools)
2 a module was force loaded by insmod -f (set by modutils and
module-init-tools)
4 unsafe SMP processors: SMP with CPUs not designed for SMP
8 a module was force unloaded by rmmod -f (set by modutils and
module-init-tools)
16 a machine check exception has occurred
32 system has hit bad_page

[/SIZE]

[SIZE="3"]
[U]up_threshold[/U]:

this means it will increase the CPU speed when utilization is above x%

percentage values (1 to 100)

[/SIZE]

[SIZE="3"]
[U]sampling_rate[/U]:

This is how often you want the kernel to look at the CPU usage and to
make decisions on what to do about the frequency. Typically this is set
to values of around '10000' or more. If you wanted to set the sampling
rate to 1 second you would set it to 1000000.

This is measured in microseconds (one millionth of a second).

[/SIZE]

[SIZE="3"]
[U]lease-break-time[/U]:

This file specifies the grace period (in seconds) that the kernel grants
to a process holding a file lease after it has sent a signal to that
process notifying it that another process is waiting to open the file.
If the lease holder does not remove or downgrade the lease within
this grace period, the kernel forcibly breaks the lease.

[/SIZE]