mm: Abort reclaim once process goes to foreground

App compaction can not be aborted due to current design,
it causes app get stuck for a while when it resume to foreground
if app is compacting by kernel. So now we add check in kernel
while loop to abort the compaction if adj is zero.

Change-Id: I16f36a08d1a5efcb36827e84f5058abfa0a7dae0
Signed-off-by: huangzq2 <huangzq2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2014822
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
huangzq2 2024-10-08 18:49:38 +08:00 committed by Richard Raya
parent 6c1efde3d9
commit 872461aee4

View File

@ -2050,6 +2050,8 @@ static ssize_t reclaim_write(struct file *file, const char __user *buf,
if (type == RECLAIM_RANGE) {
vma = find_vma(mm, start);
while (vma) {
if (task->signal->oom_score_adj == 0)
break;
if (vma->vm_start > end)
break;
if (is_vm_hugetlb_page(vma))
@ -2063,6 +2065,9 @@ static ssize_t reclaim_write(struct file *file, const char __user *buf,
}
} else {
for (vma = mm->mmap; vma; vma = vma->vm_next) {
if (task->signal->oom_score_adj == 0)
break;
if (is_vm_hugetlb_page(vma))
continue;