Commit 087877d5 authored by zhaoyang.huang's avatar zhaoyang.huang Committed by Treehugger Robot
Browse files

BACKPORT: FROMGIT: mm: optimization on page allocation when CMA enabled

Let us look at the timeline of scenarios below with WMARK_LOW=25MB WMARK_MIN=5MB(managed pages 1.9GB). We can find that CMA begin to be used until 'C' under the method of 'fixed 2 times of free cma over free pages' which could have the scenario 'A' and 'B' into a fault state, that is, free UNMOVABLE & RECLAIMABLE pages is lower than corresponding watermark without reclaiming which should be deemed as against current memory policy. This commit try to solve this by checking zone_watermark_ok again with removing CMA pages which could lead to a
proper time point of CMA's utilization.

-- Free_pages
|
|
-- WMARK_LOW
|
-- Free_CMA
|
|
--

Free_CMA/Free_pages(MB)      A(12/30) -->  B(12/25) -->  C(12/20)
fixed 1/2 ratio                 N             N           Y
this commit                     Y             Y           Y

Bug: 286444744
Link: https://lkml.kernel.org/r/1683782550-25799-1-git-send-email-zhaoyang.huang@unisoc.com
[zhaoyang.huang: Resolved some conflict in mm/page_alloc.c]
(cherry picked from commit 82c2bc35f3dca0bb47b21866922cfd3e596c0975
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

 mm-unstable)
Change-Id: I7627efdd0ffd06b74c08694c76fdd1f8bec8b706
Signed-off-by: default avatarZhaoyang Huang <zhaoyang.huang@unisoc.com>
parent 9ab065d2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment