mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
arm64: Add fallback option during memory hot add
Section mapping is good for TLB. But sometimes, when system is low on physically continuous memory, this can cause memory allocation failures. Add a fallback option to allocate vmemmap pages from discontinuous pages. Change-Id: Ide921c36c1e8980a8af047e2c991310405804858 Signed-off-by: Arun KS <arunks@codeaurora.org> Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org> Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org> [swatsrid@codeaurora.org: Fix merge conflicts] Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org> [isaacm@codeaurora.org: resolve build errors due to API changes] Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
46d635e8bd
commit
d4dd236a95
1 changed files with 12 additions and 3 deletions
|
|
@ -1116,6 +1116,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
|
|||
pgd_t *pgdp;
|
||||
pud_t *pudp;
|
||||
pmd_t *pmdp;
|
||||
int ret = 0;
|
||||
|
||||
do {
|
||||
next = pmd_addr_end(addr, end);
|
||||
|
|
@ -1133,15 +1134,23 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
|
|||
void *p = NULL;
|
||||
|
||||
p = vmemmap_alloc_block_buf(PMD_SIZE, node);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
if (!p) {
|
||||
#ifdef CONFIG_MEMORY_HOTPLUG
|
||||
vmemmap_free(start, end, altmap);
|
||||
#endif
|
||||
ret = -ENOMEM;
|
||||
break;
|
||||
}
|
||||
|
||||
pmd_set_huge(pmdp, __pa(p), __pgprot(PROT_SECT_NORMAL));
|
||||
} else
|
||||
vmemmap_verify((pte_t *)pmdp, node, addr, next);
|
||||
} while (addr = next, addr != end);
|
||||
|
||||
return 0;
|
||||
if (ret)
|
||||
return vmemmap_populate_basepages(start, end, node);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
#endif /* !ARM64_SWAPPER_USES_SECTION_MAPS */
|
||||
void vmemmap_free(unsigned long start, unsigned long end,
|
||||
|
|
|
|||
Loading…
Reference in a new issue