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>
This commit is contained in:
Vijayanand Jitta 2018-04-10 16:27:47 -07:00
parent 1f350f02fc
commit d97c09c153
2 changed files with 14 additions and 0 deletions

View file

@ -205,6 +205,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.
*/

View file

@ -1879,6 +1879,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.
*/