linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: linux-mm@kvack.org, x86@kernel.org, Mike Rapoport <rppt@kernel.org>
Subject: Re: [PATCH] bootmem: Stop using page->index
Date: Tue, 24 Sep 2024 17:51:06 +0100	[thread overview]
Message-ID: <ZvLt-kkW2ljxSLyl@casper.infradead.org> (raw)
In-Reply-To: <CAJD7tkZ8mA-VeoUfE+ZWjv6JNrxdkRCPNfq+GQxay72aJvVUtQ@mail.gmail.com>

On Thu, Sep 12, 2024 at 02:56:44PM -0700, Yosry Ahmed wrote:
> On Thu, Sep 12, 2024 at 2:51 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Thu, Sep 12, 2024 at 12:04:18PM -0700, Yosry Ahmed wrote:
> > > On Thu, Sep 12, 2024 at 11:56 AM Matthew Wilcox (Oracle)
> > > <willy@infradead.org> wrote:
> > > >
> > > > Encode the type into the bottom four bits of page->private and the
> > > > info into the remaining bits.  Also turn the bootmem type into a
> > > > named enum.
> >
> > > > @@ -21,9 +20,19 @@ enum {
> > > >  void __init register_page_bootmem_info_node(struct pglist_data *pgdat);
> > > >
> > > >  void get_page_bootmem(unsigned long info, struct page *page,
> > > > -                     unsigned long type);
> > > > +               enum bootmem_type type);
> > > >  void put_page_bootmem(struct page *page);
> > > >
> > > > +static inline enum bootmem_type bootmem_type(const struct page *page)
> > > > +{
> > > > +       return (unsigned long)page->private & 0xf;
> > > > +}
> > > > +
> > > > +static inline unsigned long bootmem_info(const struct page *page)
> > > > +{
> > > > +       return (unsigned long)page->private >> 4;
> > > > +}
> > >
> > > Would it be better to define the number of bits used for the type as a
> > > macro and use it throughout (bootmem_type(), bootmem_info(),
> > > get_page_bootmem())?.
> >
> > I think this is an adequate abstraction already.
> 
> It's not a big deal, but if we want to change the number of bits later
> we change one macro definition instead of 5 lines of code across two
> different files.

That doesn't sound like an obvious win to me.  Look, if you care, send
a patch.  What I have is definitely an improvement over what is there
now; you're just complaining that you think it could be even better,
and I disagree that what you want will be better than what I have.
The only reasonable approach is to merge my patch and then discuss
yours separately.


      reply	other threads:[~2024-09-24 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12 18:55 Matthew Wilcox (Oracle)
2024-09-12 19:04 ` Yosry Ahmed
2024-09-12 21:51   ` Matthew Wilcox
2024-09-12 21:56     ` Yosry Ahmed
2024-09-24 16:51       ` Matthew Wilcox [this message]

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=ZvLt-kkW2ljxSLyl@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    --cc=x86@kernel.org \
    --cc=yosryahmed@google.com \
    /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