summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorb37945 <b37945@freescale.com>2014-07-25 16:59:31 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2014-07-28 10:58:09 +0800
commit209f7d3f4d557a55499759310dad2f2228fae81d (patch)
treeb5c8724bed7af7f199a81624912ea368456221c4
parentc8c68f917289148326e5cd68fa688770ca95b814 (diff)
ENGR00323977 fix UI no response or trigger lowmemorykiller easily.
The root cause is CMA memory configured to be too large. So system memory is exhausted easily, but it can't trigger lowmemorykiller. The first step to resolve this is change CMA memory to 384M. Then reduce CMA pages from free pages when allocate non-movable memory. Low down minfree to half because it is only for non-movable memory. Signed-off-by: b37945 <b37945@freescale.com>
-rw-r--r--drivers/staging/android/lowmemorykiller.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index a56e0894f668..944499bac94c 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -81,12 +81,20 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
int other_file = global_page_state(NR_FILE_PAGES) -
global_page_state(NR_SHMEM);
+ /*reduce CMA pages from free pages when allocate non-movable memory.*/
+ if (allocflags_to_migratetype(sc->gfp_mask) != MIGRATE_MOVABLE)
+ other_free = other_free - global_page_state(NR_FREE_CMA_PAGES);
+
if (lowmem_adj_size < array_size)
array_size = lowmem_adj_size;
if (lowmem_minfree_size < array_size)
array_size = lowmem_minfree_size;
for (i = 0; i < array_size; i++) {
minfree = lowmem_minfree[i];
+ /*low down minfree to half when allocate non-movable memory.*/
+ if (allocflags_to_migratetype(sc->gfp_mask) != MIGRATE_MOVABLE)
+ minfree = minfree / 2;
+
if (other_free < minfree && other_file < minfree) {
min_score_adj = lowmem_adj[i];
break;