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: Thu, 12 Sep 2024 22:51:48 +0100 [thread overview]
Message-ID: <ZuNidLGz6TGcme4e@casper.infradead.org> (raw)
In-Reply-To: <CAJD7tkYQUFWBAQKtzx9DGv5g5kGpSB-j1+nortYxhGU7SFuc=w@mail.gmail.com>
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.
next prev parent reply other threads:[~2024-09-12 21: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 [this message]
2024-09-12 21:56 ` Yosry Ahmed
2024-09-24 16:51 ` Matthew Wilcox
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=ZuNidLGz6TGcme4e@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