OSDN Git Service

lowmemorykiller: Account for extra_free_kbytes in calcuations
authorJeff Vanhoof <qjv001@motorola.com>
Thu, 19 Oct 2017 10:39:30 +0000 (05:39 -0500)
committer0ranko0P <ranko0p@outlook.com>
Sat, 7 Dec 2019 10:22:21 +0000 (18:22 +0800)
Account for extra_free_kbytes in calcuations

CRs-fixed: (CR)
Signed-off-by: Jeff Vanhoof <qjv001@motorola.com>
Change-Id: I2c44a1775d43fad40cf49d6303b7552c2c089b6e
Reviewed-on: https://gerrit.mot.com/1076213
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Coverity Analysis <coverity@motorola.com>
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key

drivers/staging/android/lowmemorykiller.c

index 019eb59..e84b581 100644 (file)
@@ -47,6 +47,8 @@
 #include "trace/lowmemorykiller.h"
 
 static u32 lowmem_debug_level = 1;
+extern int extra_free_kbytes;
+
 static short lowmem_adj[6] = {
        0,
        1,
@@ -116,7 +118,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
        if (lowmem_minfree_size < array_size)
                array_size = lowmem_minfree_size;
        for (i = 0; i < array_size; i++) {
-               minfree = lowmem_minfree[i];
+               minfree = lowmem_minfree[i] +
+                         ((extra_free_kbytes * 1024) / PAGE_SIZE);
                if (other_free < minfree && other_file < minfree) {
                        min_score_adj = lowmem_adj[i];
                        minfree_count_offset = i;