ANDROID: vendor_hooks: add hook before batch free into pcp
Some path will release folios into pcp batched, like binder put(shmem release), HeapTaskDaemon reclaim and batch release. By this hook, we can hold folios before it into pcp. Bug: 389826135 Change-Id: I0b5023e2362fed54a56513f695da1b45ffee4339 Signed-off-by: Huan Yang <link@vivo.corp-partner.google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
0d385a5b58
commit
01d2987ea8
@@ -222,3 +222,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_flush_work_wait_finish);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_entry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_unref_folios_to_pcp_bypass);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
struct shmem_inode_info;
|
||||
struct folio;
|
||||
struct folio_batch;
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_shmem_get_folio,
|
||||
TP_PROTO(struct shmem_inode_info *info, struct folio **folio),
|
||||
@@ -87,6 +88,10 @@ 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_free_unref_folios_to_pcp_bypass,
|
||||
TP_PROTO(struct folio_batch *folios, bool *bypass),
|
||||
TP_ARGS(folios, bypass));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
@@ -2703,6 +2703,7 @@ void free_unref_folios(struct folio_batch *folios)
|
||||
struct per_cpu_pages *pcp = NULL;
|
||||
struct zone *locked_zone = NULL;
|
||||
int i, j;
|
||||
bool skip_free = false;
|
||||
|
||||
/* Prepare folios for freeing */
|
||||
for (i = 0, j = 0; i < folios->nr; i++) {
|
||||
@@ -2728,6 +2729,10 @@ void free_unref_folios(struct folio_batch *folios)
|
||||
}
|
||||
folios->nr = j;
|
||||
|
||||
trace_android_vh_free_unref_folios_to_pcp_bypass(folios, &skip_free);
|
||||
if (skip_free)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < folios->nr; i++) {
|
||||
struct folio *folio = folios->folios[i];
|
||||
struct zone *zone = folio_zone(folio);
|
||||
@@ -2789,6 +2794,7 @@ void free_unref_folios(struct folio_batch *folios)
|
||||
pcp_spin_unlock(pcp);
|
||||
pcp_trylock_finish(UP_flags);
|
||||
}
|
||||
out:
|
||||
folio_batch_reinit(folios);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user