Re: [PATCH] mm: Introduce page_size()

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

 



On Tue, Jan 01, 2019 at 08:57:53AM +0530, Aneesh Kumar K.V wrote:
> Matthew Wilcox <willy@xxxxxxxxxxxxx> writes:
> > +/* 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)?

I think that's a terrible idea.  Actually, I think the whole way we handle
compound pages is terrible; we should only ever see head pages.  Doing
page cache lookups should only give us head pages.  Calling pfn_to_page()
should give us the head page.  We should only put head pages into SG lists.
Everywhere you see a struct page should only be a head page.

I know we're far from that today, and there's lots of work to be done
to get there.  But the current state of handling compound pages is awful
and confusing.

Also, page_size() isn't just for compound pages.  It works for regular
pages too.  I'd be open to putting a VM_BUG_ON(PageTail(page)) in it
to catch people who misuse it.




[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