lowmemorykiller: make default lowmemorykiller debug message useful

lowmemorykiller debug messages are inscrutable and mostly useful
for debugging the lowmemorykiller, not explaining why a process
was killed.  Make the messages more useful by prefixing them
with "lowmemorykiller: " and explaining in more readable terms
what was killed, who it was killed for, and why it was killed.

The messages now look like:
[   76.997631] lowmemorykiller: Killing 'droid.gallery3d' (2172), adj 1000,
[   76.997635]    to free 27436kB on behalf of 'kswapd0' (29) because
[   76.997638]    cache 122624kB is below limit 122880kB for oom_score_adj 1000
[   76.997641]    Free memory is -53356kB above reserved

A negative number for free memory above reserved means some of the
reserved memory has been used and is being regenerated by kswapd,
which is likely what called the shrinkers.

Change-Id: I1fe983381e73e124b90aa5d91cb66e55eaca390f
Signed-off-by: Colin Cross <ccross@android.com>
staging: android: lowmemorykiller: Management of not killable processes

This feature allows the user to define processes and system processes
white-lists filled with the preferred process names and to not be killed
by lowmemorykiller, unless it is absolutely necessary.

This feature exposes four new lowmemorykiller parameters:
- donotkill_proc, is the flag to enable / disable this feature for the
  processes chosen by the user
- donotkill_sysproc, is the flag to enable / disable this feature for the
  system processes chosen by the user
- donotkill_proc_names, is the list of process names (comma separated)
  chosen by the user to be preserved from killing
- donotkill_sysproc_names, is the list of user system process names (comma separated)
  chosen by the user to be preserved from killing

When a the lowmemorykiller needs to free ram, it will first kill the processes
not included inside the two process name lists chosen by the user.
If there are no more standard killable processes, then it will be necessary to
kill one of the processes included inside one of the two white-lists, to
prevent system hangs, slowdowns, etc.

Conflicts:
	drivers/staging/android/lowmemorykiller.c
android/lowmemorykiller: Account for total_swapcache_pages

The lowmemorykiller relies on NR_FILE_PAGES when measureing
the amount of reclaimable memory in the system.
However when swap is enabled swap cache pages are counted
in NR_FILE_PAGES, and swap cache pages aren't as reclaimable
in low memory as file cache pages. Therefore a large swap
cache can result in the lowmemorykiller not running and
an OOM occuring.

In order to ensure the lowmemorykiller properly evaluates the
amount of reclaimable memory don't count the swap cache pages.

Change-Id: I38239283e572f814b277c718eaf6be7f92abacbb
Signed-off-by: Liam Mark <lmark@codeaurora.org>

Conflicts:
	drivers/staging/android/lowmemorykiller.c
lowmemorykiller: Account for highmem during kswapd reclaim

Currenlty most memory reclaim is done through kswapd.
Since kswapd uses a gfp mask of GFP_KERNEL, and because
the lowmemorykiller is zone aware, the lowmemorykiller will
ignore highmem most of the time.
This results in the lowmemorykiller being overly aggressive.

The fix to this issue is to allow the lowmemorykiller to
count highmem when being called by the kswapd if the lowmem
watermarks are satisfied.

Change-Id: I938644584f374763d10d429d835e74daa4854a38
Signed-off-by: Liam Mark <lmark@codeaurora.org>
(cherry picked from commit e738360cd6a03df15087c3aee750b66de4359a30)
Revert "lowmemorykiller: Don't count reserve page twice"

This reverts commit d73f05ceab2717c23f00bfeffa31a7dedd15569a.

The patch is causing device crash while running
kernel tests on mainline. The change was to
make LMK less aggressive.

Change-Id: I272bf5ccd54a29de1c770d69af7fea2963f46333
Signed-off-by: Susheel Khiani <skhiani@codeaurora.org>
lowmemorykiller: Don't count reserve page twice

This is essentially revert of
dc41a1c61a00f7f6213a6ff164495611fd283dbb
Revert "lowmemorykiller: Don't count reserve page twice"

We need to resolve double accounting of the reserve
pages. Lastly, we have reverted this suspecting this
as culprit of some issue. But the nature of this patch
is cleaner and solving real issue of mis-accounting.

Change-Id: I29debaa1bc05703205b323b458f2dfe2938fdfa9
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>