ANDROID: vendor_hooks: Add hooks to for alloc_contig_range

Provide a vendor hook to allow drain_all_pages to be skipped
during alloc_contig_range in some cases to avoid delays caused by
it in cases when the benefits of draining pcp lists are known
to be small.

Bug: 224732340
Signed-off-by: Peifeng Li <lipeifeng@oppo.com>
Change-Id: I0a82f668cf985ad5344d666c0c6372a7e61c3798
This commit is contained in:
Peifeng Li
2022-03-15 21:24:08 +08:00
committed by Suren Baghdasaryan
parent bc159fee3d
commit a2485b8abd
3 changed files with 9 additions and 1 deletions

View File

@@ -8720,6 +8720,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
unsigned long outer_start, outer_end;
unsigned int order;
int ret = 0;
bool skip_drain_all_pages = false;
struct compact_control cc = {
.nr_migratepages = 0,
@@ -8765,7 +8766,10 @@ int alloc_contig_range(unsigned long start, unsigned long end,
return ret;
}
drain_all_pages(cc.zone);
trace_android_vh_cma_drain_all_pages_bypass(migratetype,
&skip_drain_all_pages);
if (skip_drain_all_pages)
drain_all_pages(cc.zone);
/*
* In case of -EBUSY, we'd like to know which page causes problem.