fs:proc: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: I962171d99e8911219984563d24fdf27e15e648e5
Signed-off-by: lulei1 <lulei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2156599
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Zhangqing Huang <huangzq2@motorola.com>
Reviewed-by: Guolin Wang <wanggl3@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
lulei1 authored and Gilberto Gambugge committed 2023-06-01 00:48:51 -03:00
1 parent bc23012f17
commit 93b53df183
1 file changed
+8
+8
View File
@@ -1957,6 +1957,10 @@ static ssize_t reclaim_write(struct file *file, const char __user *buf,
if (type == RECLAIM_RANGE) { if (type == RECLAIM_RANGE) {
vma = find_vma(mm, start); vma = find_vma(mm, start);
while (vma) { while (vma) {
/* Moto lulei1: abort reclaim if app goes to foreground. */
if (task->signal->oom_score_adj == 0)
break;
if (vma->vm_start > end) if (vma->vm_start > end)
break; break;
if (is_vm_hugetlb_page(vma)) if (is_vm_hugetlb_page(vma))
@@ -1970,6 +1974,10 @@ static ssize_t reclaim_write(struct file *file, const char __user *buf,
} }
} else { } else {
for (vma = mm->mmap; vma; vma = vma->vm_next) { for (vma = mm->mmap; vma; vma = vma->vm_next) {
/* Moto lulei1: abort reclaim if app goes to foreground. */
if (task->signal->oom_score_adj == 0)
break;
if (is_vm_hugetlb_page(vma)) if (is_vm_hugetlb_page(vma))
continue; continue;