Matthew Wilcox <willy@xxxxxxxxxxxxx> writes: > static inline unsigned hstate_index_to_shift(unsigned index) > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 5411de93a363e..e920ef9927539 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -712,6 +712,12 @@ static inline void set_compound_order(struct page *page, unsigned int 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 (unsigned long)PAGE_SIZE << compound_order(page); > +} > + How about compound_page_size() to make it clear this is for compound_pages? Should we make it work with Tail pages by doing compound_head(page)? -aneesh