BACKPORT: mm: introduce page_size()
Patch series "Make working with compound pages easier", v2. These three patches add three helpers and convert the appropriate places to use them. This patch (of 3): It's unnecessarily hard to find out the size of a potentially huge page. Replace 'PAGE_SIZE << compound_order(page)' with page_size(page). Link: http://lkml.kernel.org/r/20190721104612.19120-2-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit a50b854e073cd3335bbbada8dcff83a857297dd7) Change-Id: Ic8f9fcab6c6dba7b98e2e218728cbcb134869bbc Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
This commit is contained in:
committed by
Tao Huang
parent
0b26b5304d
commit
b51d395d4f
@ -736,6 +736,12 @@ static inline void set_compound_order(struct page *page, unsigned int order)
|
|||||||
page[1].compound_order = order;
|
page[1].compound_order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the number of bytes in this potentially compound page. */
|
||||||
|
static inline unsigned long page_size(struct page *page)
|
||||||
|
{
|
||||||
|
return PAGE_SIZE << compound_order(page);
|
||||||
|
}
|
||||||
|
|
||||||
void free_compound_page(struct page *page);
|
void free_compound_page(struct page *page);
|
||||||
|
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
|
|||||||
Reference in New Issue
Block a user