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: 394900912
Bug: 199236943
Change-Id: I7b3641f7c6ad918f4111c98d715904477f92185b
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
Signed-off-by: Jaskaran Singh <quic_jasksing@quicinc.com>
This commit is contained in:
Vijayanand Jitta
2021-01-12 00:15:31 +05:30
committed by Treehugger Robot
parent ddb5042bd8
commit 9cb83ca686
2 changed files with 22 additions and 1 deletions
+3
View File
@@ -3,11 +3,14 @@
#define __LINUX_PAGE_OWNER_H
#include <linux/jump_label.h>
#include <linux/stackdepot.h>
#ifdef CONFIG_PAGE_OWNER
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 short order);
extern void __set_page_owner(struct page *page,
unsigned short order, gfp_t gfp_mask);
+19 -1
View File
@@ -8,7 +8,6 @@
#include <linux/page_owner.h>
#include <linux/jump_label.h>
#include <linux/migrate.h>
#include <linux/stackdepot.h>
#include <linux/seq_file.h>
#include <linux/memcontrol.h>
#include <linux/sched/clock.h>
@@ -143,6 +142,25 @@ static inline struct page_owner *get_page_owner(struct page_ext *page_ext)
return page_ext_data(page_ext, &page_owner_ops);
}
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 (!static_branch_unlikely(&page_owner_inited))
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];