ANDROID: cma: add vendor hook for cma_debug_show_areas

Add a vendor hook to show cma areas even without CONFIG_CMA_DEBUG enabled.
By default, it will be still skipped if CONFIG_CMA_DEBUG is not set.

Bug: 351175506
Change-Id: I86f37e3f56545547a65381a20b4d50b82c5074e9
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk 2024-07-11 12:08:36 +09:00 committed by Treehugger Robot
parent 2ca27754f0
commit c6ba1fd41e
3 changed files with 14 additions and 3 deletions

View File

@ -438,3 +438,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pr_set_vma_name_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rebalance_anon_lru_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_debug_show_areas);

View File

@ -295,6 +295,9 @@ DECLARE_HOOK(android_vh_filemap_update_page,
TP_PROTO(struct address_space *mapping, struct folio *folio,
struct file *file),
TP_ARGS(mapping, folio, file));
DECLARE_HOOK(android_vh_cma_debug_show_areas,
TP_PROTO(bool *show),
TP_ARGS(show));
#endif /* _TRACE_HOOK_MM_H */

View File

@ -392,12 +392,22 @@ err:
}
#ifdef CONFIG_CMA_DEBUG
#define CMA_DEBUG_SHOW_AREAS_DEFAULT true
#else
#define CMA_DEBUG_SHOW_AREAS_DEFAULT false
#endif
static void cma_debug_show_areas(struct cma *cma)
{
unsigned long next_zero_bit, next_set_bit, nr_zero;
unsigned long start = 0;
unsigned long nr_part, nr_total = 0;
unsigned long nbits = cma_bitmap_maxno(cma);
bool show = CMA_DEBUG_SHOW_AREAS_DEFAULT;
trace_android_vh_cma_debug_show_areas(&show);
if (!show)
return;
spin_lock_irq(&cma->lock);
pr_info("number of available pages: ");
@ -416,9 +426,6 @@ static void cma_debug_show_areas(struct cma *cma)
pr_cont("=> %lu free of %lu total pages\n", nr_total, cma->count);
spin_unlock_irq(&cma->lock);
}
#else
static inline void cma_debug_show_areas(struct cma *cma) { }
#endif
/**
* __cma_alloc() - allocate pages from contiguous area