On 1 Jan 2019, at 19:58, Matthew Wilcox wrote: > On Tue, Jan 01, 2019 at 03:11:04PM -0500, Zi Yan wrote: >> On 1 Jan 2019, at 1:39, Matthew Wilcox wrote: >> >>> On Tue, Jan 01, 2019 at 02:02:22AM +0300, Kirill A. Shutemov wrote: >>>> On Mon, Dec 31, 2018 at 05:42:23AM -0800, Matthew Wilcox wrote: >>>>> It's unnecessarily hard to find out the size of a potentially huge page. >>>>> Replace 'PAGE_SIZE << compound_order(page)' with page_size(page). >>>> >>>> Good idea. >>>> >>>> Should we add page_mask() and page_shift() too? >>> >>> I'm not opposed to that at all. I also have a patch to add compound_nr(): >>> >>> +/* Returns the number of pages in this potentially compound page. */ >>> +static inline unsigned long compound_nr(struct page *page) >>> +{ >>> + return 1UL << compound_order(page); >>> +} >>> >>> I just haven't sent it yet ;-) It should, perhaps, be called page_count() >>> or nr_pages() or something. That covers most of the remaining users of >>> compound_order() which look awkward. >> >> We already have hpage_nr_pages() to show the number of pages. Why do we need >> another one? > > Not all compound pages are PMD sized. Right, and THPs are also compound pages. Maybe using your compound_nr() in hpage_nr_pages() to factor out the common code if compound_nr() is going to be added? -- Best Regards, Yan Zi
Attachment:
signature.asc
Description: OpenPGP digital signature