mm: pin locked file after fault. [1/2]
PD#SWPL-95400
Problem:
If we pin a file in android, the whole data of this file
will be loaded to DDR, but most of these data may not be
used, this caused memory waste.
Solution:
delay mark mlocked flags for unevictable pages until
it has been faulted.
You can use following command to disable this function:
echo 0 > /proc/sys/vm/shrink_unevictable
Verify:
sc2_ah212
Change-Id: I05bb7654cc228604fe692429efbe40af713ca5c3
Signed-off-by: Jianxiong Pan <jianxiong.pan@amlogic.com>
diff --git a/mm/migrate.c b/mm/migrate.c
index c89a327..9b14fe8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -54,6 +54,9 @@
#include <linux/amlogic/aml_cma.h>
#include <linux/delay.h>
#endif
+#ifdef CONFIG_AMLOGIC_PIN_LOCKED_FILE
+#include <linux/amlogic/pin_file.h>
+#endif
#include <asm/tlbflush.h>
@@ -1295,6 +1298,10 @@ static int unmap_and_move(new_page_t get_new_page,
else
put_page(newpage);
}
+#ifdef CONFIG_AMLOGIC_PIN_LOCKED_FILE
+ if (reason == MR_CONTIG_RANGE && rc == MIGRATEPAGE_SUCCESS)
+ aml_clear_pin_locked_file(page);
+#endif
return rc;
}