summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijayanand Jitta <vjitta@codeaurora.org>2018-04-10 16:27:47 -0700
committerVijayanand Jitta <vjitta@codeaurora.org>2018-05-08 11:08:42 +0530
commitd97c09c1531f4a6c427a33f6d6bf83d1cc1f8098 (patch)
tree3eabb924ceae4cbc6ed3a4c52591f41e404a0d3c
parent1f350f02fcb9075c8dfbd8f3d329244ebd0fbcd6 (diff)
mm: treat indirectly reclaimable memory as free in overcommit logic
Indirectly reclaimable memory can consume a significant part of total memory and it's actually reclaimable (it will be released under actual memory pressure).This patch considers it as free in overcommit logic. This patch is referenced from commit d79f7aa496fc ("mm: treat indirectly reclaimable memory as free in overcommit logic") on upstream, as node based vmstat global_node_page_state is not present zone based vmstat global_page_state is used instead. Change-Id: I9af71c566c83e24cd12e7653782b1898ccc7d680 Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
-rw-r--r--mm/mmap.c7
-rw-r--r--mm/nommu.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 2339b533f4b2..5457c5f4935b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -206,6 +206,13 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
free += global_page_state(NR_SLAB_RECLAIMABLE);
/*
+ * Part of the kernel memory, which can be released
+ * under memory pressure.
+ */
+ free += global_page_state(
+ NR_INDIRECTLY_RECLAIMABLE_BYTES) >> PAGE_SHIFT;
+
+ /*
* Leave reserved pages. The pages are not for anonymous pages.
*/
if (free <= totalreserve_pages)
diff --git a/mm/nommu.c b/mm/nommu.c
index 92be862c859b..8d75e425c21c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1880,6 +1880,13 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
free += global_page_state(NR_SLAB_RECLAIMABLE);
/*
+ * Part of the kernel memory, which can be released
+ * under memory pressure.
+ */
+ free += global_page_state(
+ NR_INDIRECTLY_RECLAIMABLE_BYTES) >> PAGE_SHIFT;
+
+ /*
* Leave reserved pages. The pages are not for anonymous pages.
*/
if (free <= totalreserve_pages)