Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> wrote on 2013/04/17 02:37:40: > Instead of bothering to store the index, why not just calculate it, like: > > On 04/15/2013 08:37 PM, zhang.yi20@xxxxxxxxxx wrote: > > +static inline int get_page_compound_index(struct page *page) > > +{ > > + if (PageHead(page)) > > + return 0; > > + return compound_head(page) - page; > > +} > > BTW, you've really got to get your mail client fixed. Your patch is > still line-wrapped. I agree that I should calculate the compound index, but refer to prep_compound_gigantic_page, I think it may like this: +static inline int get_page_compound_index(struct page *page) +{ + struct page *head_page; + if (PageHead(page)) + return 0; + + head_page = compound_head(page); + if (compound_order(head_page) >= MAX_ORDER) + return page_to_pfn(page) - page_to_pfn(head_page); + else + return page - compound_head(page); +} -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>