ANDROID: mm: add vendor hook for __alloc_pages_slowpath()
Add vendor hooks in __alloc_pages_slowpath() to print debug logs on allocation delay. trace_android_vh_alloc_pages_slowpath() already exists but new vendor hooks are needed for more information. This also merges change in https://android-review.googlesource.com/c/kernel/common/+/2897503. Bug: 351175506 Change-Id: If04c64dc436b0874a06f1a0a96cde918e96c1bb2 Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
committed by
Suren Baghdasaryan
parent
2bd38e582f
commit
8f858585f0
@@ -305,3 +305,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rebalance_anon_lru_bypass);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_trigger_vendor_lmk_kill);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath_end);
|
||||
|
||||
@@ -188,6 +188,15 @@ DECLARE_HOOK(android_vh_show_smap,
|
||||
unsigned long swap_shared, unsigned long writeback,
|
||||
unsigned long same, unsigned long huge),
|
||||
TP_ARGS(m, swap_shared, writeback, same, huge));
|
||||
DECLARE_HOOK(android_vh_alloc_pages_slowpath_start,
|
||||
TP_PROTO(u64 *stime),
|
||||
TP_ARGS(stime));
|
||||
DECLARE_HOOK(android_vh_alloc_pages_slowpath_end,
|
||||
TP_PROTO(gfp_t *gfp_mask, unsigned int order, unsigned long alloc_start,
|
||||
u64 stime, unsigned long did_some_progress,
|
||||
unsigned long pages_reclaimed, int retry_loop_count),
|
||||
TP_ARGS(gfp_mask, order, alloc_start, stime, did_some_progress,
|
||||
pages_reclaimed, retry_loop_count));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
+10
-1
@@ -4359,7 +4359,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
const bool costly_order = order > PAGE_ALLOC_COSTLY_ORDER;
|
||||
struct page *page = NULL;
|
||||
unsigned int alloc_flags;
|
||||
unsigned long did_some_progress;
|
||||
unsigned long did_some_progress = 0;
|
||||
enum compact_priority compact_priority;
|
||||
enum compact_result compact_result;
|
||||
int compaction_retries;
|
||||
@@ -4367,6 +4367,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
unsigned int cpuset_mems_cookie;
|
||||
unsigned int zonelist_iter_cookie;
|
||||
int reserve_flags;
|
||||
unsigned long alloc_start = jiffies;
|
||||
unsigned long pages_reclaimed = 0;
|
||||
int retry_loop_count = 0;
|
||||
u64 stime = 0;
|
||||
|
||||
if (unlikely(nofail)) {
|
||||
/*
|
||||
@@ -4386,6 +4390,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
||||
*/
|
||||
WARN_ON_ONCE(current->flags & PF_MEMALLOC);
|
||||
}
|
||||
trace_android_vh_alloc_pages_slowpath_start(&stime);
|
||||
|
||||
restart:
|
||||
compaction_retries = 0;
|
||||
@@ -4492,6 +4497,7 @@ restart:
|
||||
}
|
||||
|
||||
retry:
|
||||
retry_loop_count++;
|
||||
/* Ensure kswapd doesn't accidentally go to sleep as long as we loop */
|
||||
if (alloc_flags & ALLOC_KSWAPD)
|
||||
wake_all_kswapds(order, gfp_mask, ac);
|
||||
@@ -4528,6 +4534,7 @@ retry:
|
||||
/* Try direct reclaim and then allocating */
|
||||
page = __alloc_pages_direct_reclaim(gfp_mask, order, alloc_flags, ac,
|
||||
&did_some_progress);
|
||||
pages_reclaimed += did_some_progress;
|
||||
if (page)
|
||||
goto got_pg;
|
||||
|
||||
@@ -4631,6 +4638,8 @@ fail:
|
||||
warn_alloc(gfp_mask, ac->nodemask,
|
||||
"page allocation failure: order:%u", order);
|
||||
got_pg:
|
||||
trace_android_vh_alloc_pages_slowpath_end(&gfp_mask, order, alloc_start,
|
||||
stime, did_some_progress, pages_reclaimed, retry_loop_count);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user