mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 12:58:12 -04:00
Set max_ra_pages according to total ram size
Set 8 for ram size < 8G RAM and 16 for >= 8G RAM Change-Id: I3b3561cf69f0b8e083395752806db652cc873289 Reviewed-on: https://gerrit.mot.com/2718477 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
11786f6aae
commit
4c1747097c
1 changed files with 13 additions and 1 deletions
|
|
@ -16,7 +16,7 @@
|
|||
#include <linux/pagemap.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
static int max_ra_pages = 8;
|
||||
static int max_ra_pages = -1;
|
||||
module_param(max_ra_pages, int, S_IRUGO | S_IWUSR);
|
||||
MODULE_PARM_DESC(max_ra_pages, "Max read ahead pages");
|
||||
|
||||
|
|
@ -105,9 +105,21 @@ static void __nocfi filemap_fault_cache_page(void *p, struct vm_fault *vmf, stru
|
|||
static int __nocfi __init moto_mmap_fault_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
int ramsize_GB = (totalram_pages() >> (30 - PAGE_SHIFT)) + 1;
|
||||
|
||||
if (max_ra_pages == -1) {
|
||||
/* Set 8 pages for < 8G RAM and set 16 pages for >= 8G RAM */
|
||||
if (ramsize_GB < 8)
|
||||
max_ra_pages = 8;
|
||||
else
|
||||
max_ra_pages = 16;
|
||||
}
|
||||
|
||||
#if defined(TUNE_MMAP_READAROUND)
|
||||
pr_info("Using the new mmap fault driver, totalram size=%dGB", ramsize_GB);
|
||||
ret = register_trace_android_vh_tune_mmap_readaround(tune_mmap_readaround, NULL);
|
||||
#else
|
||||
pr_info("Using the legacy mmap fault driver, totalram size=%dGB", ramsize_GB);
|
||||
ret = register_trace_android_vh_filemap_fault_get_page(filemap_fault_get_page, NULL) ?:
|
||||
register_trace_android_vh_filemap_fault_cache_page(filemap_fault_cache_page, NULL);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue