提交 e2cfc911 编写于 作者: J Joonsoo Kim 提交者: Linus Torvalds

mm/page_owner: set correct gfp_mask on page_owner

Currently, we set wrong gfp_mask to page_owner info in case of isolated
freepage by compaction and split page.  It causes incorrect mixed
pageblock report that we can get from '/proc/pagetypeinfo'.  This metric
is really useful to measure fragmentation effect so should be accurate.
This patch fixes it by setting correct information.

Without this patch, after kernel build workload is finished, number of
mixed pageblock is 112 among roughly 210 movable pageblocks.

But, with this fix, output shows that mixed pageblock is just 57.
Signed-off-by: NJoonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f3a14ced
...@@ -8,6 +8,7 @@ extern struct page_ext_operations page_owner_ops; ...@@ -8,6 +8,7 @@ extern struct page_ext_operations page_owner_ops;
extern void __reset_page_owner(struct page *page, unsigned int order); extern void __reset_page_owner(struct page *page, unsigned int order);
extern void __set_page_owner(struct page *page, extern void __set_page_owner(struct page *page,
unsigned int order, gfp_t gfp_mask); unsigned int order, gfp_t gfp_mask);
extern gfp_t __get_page_owner_gfp(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)
{ {
...@@ -25,6 +26,14 @@ static inline void set_page_owner(struct page *page, ...@@ -25,6 +26,14 @@ static inline void set_page_owner(struct page *page,
__set_page_owner(page, order, gfp_mask); __set_page_owner(page, order, gfp_mask);
} }
static inline gfp_t get_page_owner_gfp(struct page *page)
{
if (likely(!page_owner_inited))
return 0;
return __get_page_owner_gfp(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)
{ {
...@@ -33,6 +42,10 @@ static inline void set_page_owner(struct page *page, ...@@ -33,6 +42,10 @@ static inline void set_page_owner(struct page *page,
unsigned int order, gfp_t gfp_mask) unsigned int order, gfp_t gfp_mask)
{ {
} }
static inline gfp_t get_page_owner_gfp(struct page *page)
{
return 0;
}
#endif /* CONFIG_PAGE_OWNER */ #endif /* CONFIG_PAGE_OWNER */
#endif /* __LINUX_PAGE_OWNER_H */ #endif /* __LINUX_PAGE_OWNER_H */
...@@ -1948,6 +1948,7 @@ void free_hot_cold_page_list(struct list_head *list, bool cold) ...@@ -1948,6 +1948,7 @@ void free_hot_cold_page_list(struct list_head *list, bool cold)
void split_page(struct page *page, unsigned int order) void split_page(struct page *page, unsigned int order)
{ {
int i; int i;
gfp_t gfp_mask;
VM_BUG_ON_PAGE(PageCompound(page), page); VM_BUG_ON_PAGE(PageCompound(page), page);
VM_BUG_ON_PAGE(!page_count(page), page); VM_BUG_ON_PAGE(!page_count(page), page);
...@@ -1961,10 +1962,11 @@ void split_page(struct page *page, unsigned int order) ...@@ -1961,10 +1962,11 @@ void split_page(struct page *page, unsigned int order)
split_page(virt_to_page(page[0].shadow), order); split_page(virt_to_page(page[0].shadow), order);
#endif #endif
set_page_owner(page, 0, 0); gfp_mask = get_page_owner_gfp(page);
set_page_owner(page, 0, gfp_mask);
for (i = 1; i < (1 << order); i++) { for (i = 1; i < (1 << order); i++) {
set_page_refcounted(page + i); set_page_refcounted(page + i);
set_page_owner(page + i, 0, 0); set_page_owner(page + i, 0, gfp_mask);
} }
} }
EXPORT_SYMBOL_GPL(split_page); EXPORT_SYMBOL_GPL(split_page);
...@@ -1994,7 +1996,7 @@ int __isolate_free_page(struct page *page, unsigned int order) ...@@ -1994,7 +1996,7 @@ int __isolate_free_page(struct page *page, unsigned int order)
zone->free_area[order].nr_free--; zone->free_area[order].nr_free--;
rmv_page_order(page); rmv_page_order(page);
set_page_owner(page, order, 0); set_page_owner(page, order, __GFP_MOVABLE);
/* Set the pageblock if the isolated page is at least a pageblock */ /* Set the pageblock if the isolated page is at least a pageblock */
if (order >= pageblock_order - 1) { if (order >= pageblock_order - 1) {
......
...@@ -76,6 +76,13 @@ void __set_page_owner(struct page *page, unsigned int order, gfp_t gfp_mask) ...@@ -76,6 +76,13 @@ void __set_page_owner(struct page *page, unsigned int order, gfp_t gfp_mask)
__set_bit(PAGE_EXT_OWNER, &page_ext->flags); __set_bit(PAGE_EXT_OWNER, &page_ext->flags);
} }
gfp_t __get_page_owner_gfp(struct page *page)
{
struct page_ext *page_ext = lookup_page_ext(page);
return page_ext->gfp_mask;
}
static ssize_t static ssize_t
print_page_owner(char __user *buf, size_t count, unsigned long pfn, print_page_owner(char __user *buf, size_t count, unsigned long pfn,
struct page *page, struct page_ext *page_ext) struct page *page, struct page_ext *page_ext)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册