Update background apps' oom_adj adjustment algorithm
authorLongXiang <xiang.long@intel.com>
Thu, 6 Dec 2012 09:10:49 +0000 (17:10 +0800)
committerLongXiang <xiang.long@intel.com>
Mon, 10 Dec 2012 03:01:06 +0000 (11:01 +0800)
commitf65a95ede21ff3aa449fe865649938971475caf8
tree5e236821e20f570de51f5189311ae1a80c81528d
parenta8edc8e2805bb546790671aab231521feaf41dcc
Update background apps' oom_adj adjustment algorithm

[Titile] Update background apps' oom_adj adjustment algorithm.
[Issue#] TDIS-1148 (https://tizendev.org/bugs/browse/TDIS-1148)
[Problem] N/A
[Cause]
There are two tasks system-server need to do when an application goes
to background:
1. Update older apps' oom_adj values to make them more vulnerable to OOM killers;
2. Kill the oldest foreground app when background apps number exceeds the limitation.
Previous algorithm will increase older apps' oom_adj whenever an app goes to
background and there's a oom_adj == 1 app exists.
[Solution]
1. Utilizes bucket sort to sort existing background apps then update their oom_adj
values one by one.
2. Kill remain apps when the limitation is reached.

Change-Id: I166b11a91d05b39704686059f633cc725413974d
ss_procmgr.c