ANDROID: mm: Add vendor hooks for __alloc_pages_slowpath
To monitor the efficiency of memory relciaming in __alloc_pages_slowpath, add vendor hooks in each stages of __alloc_pages_slowpath including __alloc_pages_may_oom and __alloc_pages_direct_reclaim. android_vh_mm_alloc_pages_direct_reclaim_enter() android_vh_mm_alloc_pages_direct_reclaim_exit(unsigned long, int) android_vh_mm_alloc_pages_may_oom_exit(struct oom_control *, unsigned long) Bug: 301044280 Change-Id: Ic5b5f1c2ad31b16e7339f539fcf54659e9acaba7 Signed-off-by: John Hsu <john.hsu@mediatek.com>
This commit is contained in:
parent
5c2855fbce
commit
0deb7bb73e
@ -337,3 +337,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_try_to_compact_pages_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_enter);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_exit);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_may_oom_exit);
|
||||
|
@ -141,6 +141,16 @@ DECLARE_HOOK(android_vh_look_around,
|
||||
struct vm_area_struct *vma, int *referenced),
|
||||
TP_ARGS(pvmw, folio, vma, referenced));
|
||||
|
||||
DECLARE_HOOK(android_vh_mm_alloc_pages_direct_reclaim_enter,
|
||||
TP_PROTO(unsigned int order),
|
||||
TP_ARGS(order));
|
||||
DECLARE_HOOK(android_vh_mm_alloc_pages_direct_reclaim_exit,
|
||||
TP_PROTO(unsigned long did_some_progress, int retry_times),
|
||||
TP_ARGS(did_some_progress, retry_times));
|
||||
struct oom_control;
|
||||
DECLARE_HOOK(android_vh_mm_alloc_pages_may_oom_exit,
|
||||
TP_PROTO(struct oom_control *oc, unsigned long did_some_progress),
|
||||
TP_ARGS(oc, did_some_progress));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
@ -4503,6 +4503,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
if (!mutex_trylock(&oom_lock)) {
|
||||
*did_some_progress = 1;
|
||||
schedule_timeout_uninterruptible(1);
|
||||
trace_android_vh_mm_alloc_pages_may_oom_exit(&oc, *did_some_progress);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -4565,6 +4566,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
}
|
||||
out:
|
||||
mutex_unlock(&oom_lock);
|
||||
trace_android_vh_mm_alloc_pages_may_oom_exit(&oc, *did_some_progress);
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -4868,10 +4870,12 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
|
||||
unsigned int alloc_flags, const struct alloc_context *ac,
|
||||
unsigned long *did_some_progress)
|
||||
{
|
||||
int retry_times = 0;
|
||||
struct page *page = NULL;
|
||||
unsigned long pflags;
|
||||
bool drained = false;
|
||||
|
||||
trace_android_vh_mm_alloc_pages_direct_reclaim_enter(order);
|
||||
psi_memstall_enter(&pflags);
|
||||
*did_some_progress = __perform_reclaim(gfp_mask, order, ac);
|
||||
if (unlikely(!(*did_some_progress)))
|
||||
@ -4889,11 +4893,12 @@ __alloc_pages_direct_reclaim(gfp_t gfp_mask, unsigned int order,
|
||||
unreserve_highatomic_pageblock(ac, false);
|
||||
drain_all_pages(NULL);
|
||||
drained = true;
|
||||
++retry_times;
|
||||
goto retry;
|
||||
}
|
||||
out:
|
||||
psi_memstall_leave(&pflags);
|
||||
|
||||
trace_android_vh_mm_alloc_pages_direct_reclaim_exit(*did_some_progress, retry_times);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user