PM: devfreq: Add conservative governor

A GPU governor is not rocket science. This one gets the job done pretty
smoothly while complying with devfreq framework rules.
PM: devfreq: Add some conservativeness
PM: devfreq: Always reflect a change of polling interval
PM: devfreq: conservative: Return 0 if GPU just started

Bailing out early is perfectly fine, so do not trigger an error in
update_devfreq.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
PM: devfreq: Fixup device transition and usage statistics

Ignore bogus data during slumber in transition and usage stats that
rendered the output basically useless. Also fix the reported GPU
frequency.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
PM: devfreq: Use high priority workqueue

It does not make sense to run kgsl on high and devfreq on regular
priority.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
PM: devfreq: Adapt devfreq_get_freq_level to cpubw requirements

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: kgsl: Export device state to devfreq

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
drivers: char: Add FRANDOM

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
staging: lmk: Fine tune OOM for screen on/off

* Increase no. of parmeters handled by minfree
* Add interface to set different OOM values for screen on/off
* Add parameter to turn on/off auto set of different OOM values

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Staging: android: timed_gpio: Fix unreg order

Fix the order of unregister timed output device to avoid
use after free bug.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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.

Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
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.

Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
mm, oom: change type of oom_score_adj to short

The maximum oom_score_adj is 1000 and the minimum oom_score_adj is -1000,
so this range can be represented by the signed short type with no
functional change.  The extra space this frees up in struct signal_struct
will be used for per-thread oom kill flags in the next patch.

** Modified to merge with Chaos Kernel

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
defconfig: update