Re: [PATCH] mm: Introduce page_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

PAGE_MASK (and its HPAGE counterparts) always confuses me because it's
a mask which returns the upper bits rather than one which returns the
lower bits.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux