Merge "mm, page_owner: dump page owner info from dump_page()"
This commit is contained in:
commit
038a9502b1
4 changed files with 37 additions and 0 deletions
|
@ -13,6 +13,7 @@ extern void __set_page_owner(struct page *page,
|
||||||
extern gfp_t __get_page_owner_gfp(struct page *page);
|
extern gfp_t __get_page_owner_gfp(struct page *page);
|
||||||
extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
|
extern void __copy_page_owner(struct page *oldpage, struct page *newpage);
|
||||||
extern void __set_page_owner_migrate_reason(struct page *page, int reason);
|
extern void __set_page_owner_migrate_reason(struct page *page, int reason);
|
||||||
|
extern void __dump_page_owner(struct page *page);
|
||||||
|
|
||||||
static inline void reset_page_owner(struct page *page, unsigned int order)
|
static inline void reset_page_owner(struct page *page, unsigned int order)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +45,11 @@ static inline void set_page_owner_migrate_reason(struct page *page, int reason)
|
||||||
if (static_branch_unlikely(&page_owner_inited))
|
if (static_branch_unlikely(&page_owner_inited))
|
||||||
__set_page_owner_migrate_reason(page, reason);
|
__set_page_owner_migrate_reason(page, reason);
|
||||||
}
|
}
|
||||||
|
static inline void dump_page_owner(struct page *page)
|
||||||
|
{
|
||||||
|
if (static_branch_unlikely(&page_owner_inited))
|
||||||
|
__dump_page_owner(page);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static inline void reset_page_owner(struct page *page, unsigned int order)
|
static inline void reset_page_owner(struct page *page, unsigned int order)
|
||||||
{
|
{
|
||||||
|
@ -62,5 +68,8 @@ static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
|
||||||
static inline void set_page_owner_migrate_reason(struct page *page, int reason)
|
static inline void set_page_owner_migrate_reason(struct page *page, int reason)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
static inline void dump_page_owner(struct page *page)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif /* CONFIG_PAGE_OWNER */
|
#endif /* CONFIG_PAGE_OWNER */
|
||||||
#endif /* __LINUX_PAGE_OWNER_H */
|
#endif /* __LINUX_PAGE_OWNER_H */
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <linux/trace_events.h>
|
#include <linux/trace_events.h>
|
||||||
#include <linux/memcontrol.h>
|
#include <linux/memcontrol.h>
|
||||||
#include <linux/migrate.h>
|
#include <linux/migrate.h>
|
||||||
|
#include <linux/page_owner.h>
|
||||||
|
|
||||||
char *migrate_reason_names[MR_TYPES] = {
|
char *migrate_reason_names[MR_TYPES] = {
|
||||||
"compaction",
|
"compaction",
|
||||||
|
@ -117,6 +118,7 @@ void dump_page_badflags(struct page *page, const char *reason,
|
||||||
void dump_page(struct page *page, const char *reason)
|
void dump_page(struct page *page, const char *reason)
|
||||||
{
|
{
|
||||||
dump_page_badflags(page, reason, 0);
|
dump_page_badflags(page, reason, 0);
|
||||||
|
dump_page_owner(page);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(dump_page);
|
EXPORT_SYMBOL(dump_page);
|
||||||
|
|
||||||
|
|
|
@ -473,6 +473,7 @@ static void bad_page(struct page *page, const char *reason,
|
||||||
printk(KERN_ALERT "BUG: Bad page state in process %s pfn:%05lx\n",
|
printk(KERN_ALERT "BUG: Bad page state in process %s pfn:%05lx\n",
|
||||||
current->comm, page_to_pfn(page));
|
current->comm, page_to_pfn(page));
|
||||||
dump_page_badflags(page, reason, bad_flags);
|
dump_page_badflags(page, reason, bad_flags);
|
||||||
|
dump_page_owner(page);
|
||||||
|
|
||||||
print_modules();
|
print_modules();
|
||||||
dump_stack();
|
dump_stack();
|
||||||
|
|
|
@ -187,6 +187,31 @@ err:
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __dump_page_owner(struct page *page)
|
||||||
|
{
|
||||||
|
struct page_ext *page_ext = lookup_page_ext(page);
|
||||||
|
struct stack_trace trace = {
|
||||||
|
.nr_entries = page_ext->nr_entries,
|
||||||
|
.entries = &page_ext->trace_entries[0],
|
||||||
|
};
|
||||||
|
gfp_t gfp_mask = page_ext->gfp_mask;
|
||||||
|
int mt = gfpflags_to_migratetype(gfp_mask);
|
||||||
|
|
||||||
|
if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) {
|
||||||
|
pr_alert("page_owner info is not active (free page?)\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_alert("page allocated via order %u, migratetype %s, "
|
||||||
|
"gfp_mask %#x(%pGg)\n", page_ext->order,
|
||||||
|
migratetype_names[mt], gfp_mask, &gfp_mask);
|
||||||
|
print_stack_trace(&trace, 0);
|
||||||
|
|
||||||
|
if (page_ext->last_migrate_reason != -1)
|
||||||
|
pr_alert("page has been migrated, last migrate reason: %s\n",
|
||||||
|
migrate_reason_names[page_ext->last_migrate_reason]);
|
||||||
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue