ANDROID: mm: add get_page_owner_handle function

Add and export get_page_owner_handle function which returns
the handle for the corresponding page_ext, this will be used
by the minidump module to get page_owner info.

Bug: 199236943
Change-Id: I7b3641f7c6ad918f4111c98d715904477f92185b
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
This commit is contained in:
Vijayanand Jitta 2021-01-12 00:15:31 +05:30
parent 409aa4d675
commit 5f85a2fca9
2 changed files with 21 additions and 0 deletions

View File

@ -8,6 +8,8 @@
extern struct static_key_false page_owner_inited;
extern struct page_ext_operations page_owner_ops;
extern depot_stack_handle_t get_page_owner_handle(struct page_ext *page_ext,
unsigned long pfn);
extern void __reset_page_owner(struct page *page, unsigned int order);
extern void __set_page_owner(struct page *page,
unsigned int order, gfp_t gfp_mask);

View File

@ -98,6 +98,25 @@ static inline struct page_owner *get_page_owner(struct page_ext *page_ext)
return (void *)page_ext + page_owner_ops.offset;
}
depot_stack_handle_t get_page_owner_handle(struct page_ext *page_ext, unsigned long pfn)
{
struct page_owner *page_owner;
depot_stack_handle_t handle;
if (!page_owner_enabled)
return 0;
page_owner = get_page_owner(page_ext);
/* skip handle for tail pages of higher order allocations */
if (!IS_ALIGNED(pfn, 1 << page_owner->order))
return 0;
handle = READ_ONCE(page_owner->handle);
return handle;
}
EXPORT_SYMBOL_NS_GPL(get_page_owner_handle, MINIDUMP);
static noinline depot_stack_handle_t save_stack(gfp_t flags)
{
unsigned long entries[PAGE_OWNER_STACK_DEPTH];