linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>, linux-mm@kvack.org
Subject: Re: [PATCH] mm: Introduce page_size()
Date: Wed, 22 May 2019 18:55:11 -0700	[thread overview]
Message-ID: <20190523015511.GD6738@bombadil.infradead.org> (raw)
In-Reply-To: <20190522130318.4ad4dda1169e652528ecd7af@linux-foundation.org>

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@virtuozzo.com> 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.


  reply	other threads:[~2019-05-23  1:55 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 18:12 Matthew Wilcox
2019-05-13 10:56 ` Michal Hocko
2019-05-13 12:43 ` Kirill Tkhai
2019-05-14 11:53   ` William Kucharski
2019-05-22 20:03   ` Andrew Morton
2019-05-23  1:55     ` Matthew Wilcox [this message]
2019-05-23 21:33       ` Andrew Morton
2019-05-23 21:44         ` Matthew Wilcox
2019-05-24  6:34           ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2018-12-31 13:42 Matthew Wilcox
2018-12-31 23:02 ` Kirill A. Shutemov
2019-01-01  6:39   ` Matthew Wilcox
2019-01-01 20:11     ` Zi Yan
2019-01-02  0:58       ` Matthew Wilcox
2019-01-02  1:16         ` Zi Yan
2019-01-01  3:27 ` Aneesh Kumar K.V
2019-01-01  3:27   ` Aneesh Kumar K.V
2019-01-01  6:30   ` Matthew Wilcox
2019-01-01 10:11     ` Aneesh Kumar K.V
2019-01-02  3:14       ` Matthew Wilcox
2019-01-02 11:46         ` William Kucharski
2019-01-02 13:09           ` Matthew Wilcox
2019-01-03 10:47             ` William Kucharski
2019-01-01 10:15     ` Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190523015511.GD6738@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox