diff --git a/drivers/android/simple_lmk.c b/drivers/android/simple_lmk.c index 3372fe21962d..215ee674d82d 100644 --- a/drivers/android/simple_lmk.c +++ b/drivers/android/simple_lmk.c @@ -75,6 +75,17 @@ static bool vtsk_is_duplicate(int vlen, struct task_struct *vtsk) return false; } +static unsigned long get_total_mm_pages(struct mm_struct *mm) +{ + unsigned long pages = 0; + int i; + + for (i = 0; i < NR_MM_COUNTERS; i++) + pages += get_mm_counter(mm, i); + + return pages; +} + static unsigned long find_victims(int *vindex, short target_adj) { unsigned long pages_found = 0; @@ -108,7 +119,7 @@ static unsigned long find_victims(int *vindex, short target_adj) /* Store this potential victim away for later */ victims[*vindex].tsk = vtsk; victims[*vindex].mm = vtsk->mm; - victims[*vindex].size = get_mm_rss(vtsk->mm); + victims[*vindex].size = get_total_mm_pages(vtsk->mm); /* Keep track of the number of pages that have been found */ pages_found += victims[*vindex].size;