Commit 8fb156c9 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Linus Torvalds

mm/page_owner: change split_page_owner to take a count

The implementation of split_page_owner() prefers a count rather than the
old order of the page.  When we support a variable size THP, we won't
have the order at this point, but we will have the number of pages.
So change the interface to what the caller and callee would prefer.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarSeongJae Park <sjpark@amazon.de>
Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Huang Ying <ying.huang@intel.com>
Link: https://lkml.kernel.org/r/20200908195539.25896-4-willy@infradead.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d01ac3c3
...@@ -11,7 +11,7 @@ extern struct page_ext_operations page_owner_ops; ...@@ -11,7 +11,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 void __split_page_owner(struct page *page, unsigned int order); extern void __split_page_owner(struct page *page, unsigned int nr);
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); extern void __dump_page_owner(struct page *page);
...@@ -31,10 +31,10 @@ static inline void set_page_owner(struct page *page, ...@@ -31,10 +31,10 @@ 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 void split_page_owner(struct page *page, unsigned int order) static inline void split_page_owner(struct page *page, unsigned int nr)
{ {
if (static_branch_unlikely(&page_owner_inited)) if (static_branch_unlikely(&page_owner_inited))
__split_page_owner(page, order); __split_page_owner(page, nr);
} }
static inline void copy_page_owner(struct page *oldpage, struct page *newpage) static inline void copy_page_owner(struct page *oldpage, struct page *newpage)
{ {
......
...@@ -2454,7 +2454,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, ...@@ -2454,7 +2454,7 @@ static void __split_huge_page(struct page *page, struct list_head *list,
ClearPageCompound(head); ClearPageCompound(head);
split_page_owner(head, HPAGE_PMD_ORDER); split_page_owner(head, HPAGE_PMD_NR);
/* See comment in __split_huge_page_tail() */ /* See comment in __split_huge_page_tail() */
if (PageAnon(head)) { if (PageAnon(head)) {
......
...@@ -3209,7 +3209,7 @@ void split_page(struct page *page, unsigned int order) ...@@ -3209,7 +3209,7 @@ void split_page(struct page *page, unsigned int order)
for (i = 1; i < (1 << order); i++) for (i = 1; i < (1 << order); i++)
set_page_refcounted(page + i); set_page_refcounted(page + i);
split_page_owner(page, order); split_page_owner(page, 1 << order);
} }
EXPORT_SYMBOL_GPL(split_page); EXPORT_SYMBOL_GPL(split_page);
......
...@@ -204,7 +204,7 @@ void __set_page_owner_migrate_reason(struct page *page, int reason) ...@@ -204,7 +204,7 @@ void __set_page_owner_migrate_reason(struct page *page, int reason)
page_owner->last_migrate_reason = reason; page_owner->last_migrate_reason = reason;
} }
void __split_page_owner(struct page *page, unsigned int order) void __split_page_owner(struct page *page, unsigned int nr)
{ {
int i; int i;
struct page_ext *page_ext = lookup_page_ext(page); struct page_ext *page_ext = lookup_page_ext(page);
...@@ -213,7 +213,7 @@ void __split_page_owner(struct page *page, unsigned int order) ...@@ -213,7 +213,7 @@ void __split_page_owner(struct page *page, unsigned int order)
if (unlikely(!page_ext)) if (unlikely(!page_ext))
return; return;
for (i = 0; i < (1 << order); i++) { for (i = 0; i < nr; i++) {
page_owner = get_page_owner(page_ext); page_owner = get_page_owner(page_ext);
page_owner->order = 0; page_owner->order = 0;
page_ext = page_ext_next(page_ext); page_ext = page_ext_next(page_ext);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment