lowmemorykiller:Account for extra_free_kbytes in calcuations
authorJeff Vanhoof <qjv001@motorola.com>
Thu, 19 Oct 2017 10:39:30 +0000 (05:39 -0500)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:37:00 +0000 (17:37 +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
Reviewed-on: https://gerrit.mot.com/1318719
Reviewed-by: Dawei Wang <wangdw10@motorola.com>
Reviewed-by: Zhichao Chen <chenzc2@motorola.com>
drivers/staging/android/lowmemorykiller.c

index 224fd9a64c12b213d08902c57cda4291c42d40fa..8f528262c35e98f0b86f12dc4152c5a58c5fa29b 100644 (file)
@@ -44,6 +44,8 @@
 #include <linux/notifier.h>
 
 static u32 lowmem_debug_level = 1;
+extern int extra_free_kbytes;
+
 static short lowmem_adj[6] = {
        0,
        1,
@@ -100,7 +102,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];
                        break;