Re: [PATCH] mm: Introduce page_size()

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

 



On Wed, May 22, 2019 at 01:03:18PM -0700, Andrew Morton wrote:
> On Mon, 13 May 2019 15:43:08 +0300 Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> wrote:
> > > +/*
> > > + * Returns the number of bytes in this potentially compound page.
> > > + * Must be called with the head page, not a tail page.
> > > + */
> > > +static inline unsigned long page_size(struct page *page)
> > > +{
> > 
> > Maybe we should underline commented head page limitation with VM_BUG_ON()?
> 
> VM_WARN_ONCE() if poss, please.
> 
> The code bloatage from that is likely to be distressing.  Perhaps
> adding an out-of-line compound_order_head_only() for this reason would
> help.  In which case, just uninline the whole thing...

I think this is unnecessary.  Nobody's currently calling the code it
replaces on a tail page, and the plan is to reduce or eliminate the
amount of places that parts of the system see tail pages.  I strongly
oppose adding any kind of check here.

> > +	return (unsigned long)PAGE_SIZE << compound_order(page);
> > + }
> 
> Also, I suspect the cast here is unneeded.  Architectures used to
> differe in the type of PAGE_SIZE but please tell me that's been fixed
> for a lomng time...

It's an unsigned int for most, if not all architectures.  For, eg,
PowerPC, a PUD page is larger than 4GB.  So let's just include the cast
and not have to worry about undefined semantics screwing us over.




[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