ANDROID: mm: add vendor hook in isolate_freepages()

By this vh, so that we can skip if this page needs to be treated
specially, like as cma.

In the Android kernel, the use of cma is restricted, and filecache
cannot use cma.But during the memory compaction process, filecache
may be migrated to cma pool, so a judgment needs to be added here
to restrict filecache from entering cma.

Bug: 309371168
Change-Id: I3ec29bdf5f7b6ac4c7af0a317aa41ad77b71444d
Signed-off-by: Qinglin Li <qinglin.li@amlogic.com>
This commit is contained in:
qinglin.li
2023-11-06 15:02:04 +08:00
parent f206a8c31c
commit 0681d570ba
3 changed files with 9 additions and 0 deletions

View File

@@ -370,3 +370,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_received);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_oem_binder_struct);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_isolate_freepages);

View File

@@ -168,6 +168,9 @@ DECLARE_HOOK(android_vh_alloc_pages_entry,
TP_PROTO(gfp_t *gfp, unsigned int order, int preferred_nid,
nodemask_t *nodemask),
TP_ARGS(gfp, order, preferred_nid, nodemask));
DECLARE_HOOK(android_vh_isolate_freepages,
TP_PROTO(struct compact_control *cc, struct page *page, bool *bypass),
TP_ARGS(cc, page, bypass));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@@ -1598,6 +1598,7 @@ static void isolate_freepages(struct compact_control *cc)
unsigned long low_pfn; /* lowest pfn scanner is able to scan */
struct list_head *freelist = &cc->freepages;
unsigned int stride;
bool bypass = false;
/* Try a small search of the free lists for a candidate */
isolate_start_pfn = fast_isolate_freepages(cc);
@@ -1653,6 +1654,10 @@ static void isolate_freepages(struct compact_control *cc)
if (!isolation_suitable(cc, page))
continue;
trace_android_vh_isolate_freepages(cc, page, &bypass);
if (bypass)
continue;
/* Found a block suitable for isolating free pages from. */
nr_isolated = isolate_freepages_block(cc, &isolate_start_pfn,
block_end_pfn, freelist, stride, false);