[LG Optimus Black] aprold:
@rgabi88: Sorry, not here to answer your question, came to fulfil my promise to comment on the before-mentioned script. Although I sincerely recommend to ditch the stock ROM.

Here are the things I learned today, please correct me if you find anything incorrect. The information below is gathered mostly from around here and you've probably already seen the bits and pieces of it. I've just written it down here to organize my thoughts and conclude the topic. I'll try to compare Juwe's script values to Nova values and come up with some kind of conclusion on the differences. I don't pretend to answer here many questions, on the contrary - this little investigation of mine raised them even more. Perhaps someone can comment on the questions in red? It's sad that kernel.org has been down for couple of weeks by now due to the security breach and there was no single source to turn to.

/sys/module/lowmemorykiller/parameters/adj

This file contains oom_adj values that specify which processes are killed of when minfree low memory limit is reached. Valid values range from -17 to 15 and value for each process is stored in /proc/<pid>/oom_adj file. The following script (purely for illustration) shows you oom_adj value for all the processes where this values is greater than 0:

#!/system/bin/sh
ps > $TMPDIR/ps.txt
echo -e "ADJ\tPID\tPPID\tUSER\tNAME"
while read user pid ppid vsize rss wchan pc s name; do
[ -f "/proc/$pid/oom_adj" ] && adj=$(head -n1 /proc/$pid/oom_adj) || adj=0
[ $adj -gt 0 ] && echo -e "$adj\t$name"
done < $TMPDIR/ps.txt
rm $TMPDIR/ps.txt

Juwe's values 0,1,2,4,6,15

Nova values 0,3,5,7,14,15

Here you can see that processes with negative oom_adj values are never killed off. Also Nova tries to kill processes later than Juwe. Question: who does (and based on what) specify the oom_adj values for processes in the first place?

Useful info here and here.

/sys/module/lowmemorykiller/parameters/minfree

This file contains numbers that represent amount of free memory when certain kind of applications get killed off. Values are in 4 kB pages (e.g. 1024 pages equals 4 MB). Applications fall into these categories:

FOREGROUND_APP: running currently on the screen

VISIBLE_APP: open and running in the background

SECONDARY_SERVER: service ready for use by an application

HIDDEN_APP: idle but still alive

CONTENT_PROVIDER: application that provides data to the system

EMPTY_APP: open but not used any more

So, the minfree file format is:

FOREGROUND_APP,VISIBLE_APP,SECONDARY_SERVER,HIDDEN_APP,CONTENT_PROVIDER,EMPTY_APP

Juwe's values: 2560,4096,6144,12288,14336,18432

Nova values 1536,2048,6656,7168,7680,8192

As you can also see that Nova is not in such a hurry to kill applications off which is good in a way that RAM is always in use as much as possible. Why would it be good to have free RAM in Android anyway?

This link has been very informative: http://www.androidcentral.com/fine-tuning-minfree-settings-improving-androids-multi-tasking

/proc/sys/vm/swappiness

This determines how aggressively the kernel swaps memory pages

Juwe 10

Nova 0

Does 0 for Nova mean that swap is completely turned off there?

/proc/sys/vm/vfs_cache_pressure

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

Juwe 50

Nova 1

Based on these values one would say that Nova tries to cache directories and inodes for as long as possible. When exactly does it get flushed then?

/proc/sys/vm/dirty_expire_centisecs

Defines when dirty data is old enough to be eligible for writeout by the pdflush daemons (in 100ths of a second).

Juwe 3000

Nova 1000

Nova will do this after 10 seconds, this is 3 times faster compared to Juwe. Is this timekeeping done for every data page or in larger blocks?

/proc/sys/vm/dirty_writeback_centisecs

Interval between pdflush writeback wakeups where 'old' data is written out to disk (again in 100ths of a second)

Juwe 500

Nova 2000

I understand that compared to Juwe this is done 4 times less frequently after every 20 seconds. Aren't these two values related in the sense that dirty_expire_centisecs/dirty_writeback_centisecs 1000/2000 is the same as 2000/1000?

/proc/sys/vm/dirty_ratio

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.

Juwe 22

Nova 90

Here we can see again that Nova delays the actual disk writes for as long as possible.

/proc/sys/vm/dirty_background_ratio

Here is the percentage where pdflush does the job itself.

Juwe 4

Nova 70

dirty_ratio and dirty_background_ratio must be percentages from two different things otherwise pdflush would do the job at 70 % and there would be nothing left for process to do at 90 %. The link below says it to be MemFree + Cached - Mapped which is whole different thing than MemTotal

More info here

I must apologise to you who looked for the answers here but encountered only more and more questions. I know now that I don't know anything yet.

Regards,

Aprold