From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "willy@infradead.org" <willy@infradead.org>,
"Hansen, Dave" <dave.hansen@intel.com>
Cc: "luto@kernel.org" <luto@kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"jeyu@kernel.org" <jeyu@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"hch@infradead.org" <hch@infradead.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"ast@kernel.org" <ast@kernel.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"andrii@kernel.org" <andrii@kernel.org>
Subject: Re: [RFC 2/3] vmalloc: Support grouped page allocations
Date: Mon, 5 Apr 2021 21:49:29 +0000 [thread overview]
Message-ID: <5cd26497530f153b0356f72ee016362e8db884cc.camel@intel.com> (raw)
In-Reply-To: <20210405213248.GN2531743@casper.infradead.org>
On Mon, 2021-04-05 at 22:32 +0100, Matthew Wilcox wrote:
> On Mon, Apr 05, 2021 at 02:01:58PM -0700, Dave Hansen wrote:
> > On 4/5/21 1:37 PM, Rick Edgecombe wrote:
> > > +static void __dispose_pages(struct list_head *head)
> > > +{
> > > + struct list_head *cur, *next;
> > > +
> > > + list_for_each_safe(cur, next, head) {
> > > + list_del(cur);
> > > +
> > > + /* The list head is stored at the start of the
> > > page */
> > > + free_page((unsigned long)cur);
> > > + }
> > > +}
> >
> > This is interesting.
> >
> > While the page is in the allocator, you're using the page contents
> > themselves to store the list_head. It took me a minute to figure
> > out
> > what you were doing here because: "start of the page" is a bit
> > ambiguous. It could mean:
> >
> > * the first 16 bytes in 'struct page'
> > or
> > * the first 16 bytes in the page itself, aka *page_address(page)
> >
> > The fact that this doesn't work on higmem systems makes this an OK
> > thing
> > to do, but it is a bit weird. It's also doubly susceptible to bugs
> > where there's a page_to_virt() or virt_to_page() screwup.
> >
> > I was *hoping* there was still sufficient space in 'struct page'
> > for
> > this second list_head in addition to page->lru. I think there
> > *should*
> > be. That would at least make this allocator a bit more "normal" in
> > not
> > caring about page contents while the page is free in the
> > allocator. If
> > you were able to do that you could do things like kmemcheck or page
> > alloc debugging while the page is in the allocator.
> >
> > Anyway, I think I'd prefer that you *try* to use 'struct page'
> > alone.
> > But, if that doesn't work out, please comment the snot out of this
> > thing
> > because it _is_ weird.
>
> Hi! Current closest-thing-we-have-to-an-expert-on-struct-page here!
>
> I haven't read over these patches yet. If these pages are in use by
> vmalloc, they can't use mapping+index because get_user_pages() will
> call
> page_mapping() and the list_head will confuse it. I think it could
> use
> index+private for a list_head.
>
> If the pages are in the buddy, I _think_ mapping+index are free.
> private
> is in use for buddy order. But I haven't read through the buddy code
> in a while.
>
> Does it need to be a doubly linked list? Can it be an hlist?
It does need to be a doubly linked list. I think they should never be
mapped to userspace. As far as the page allocator is concerned these
pages are not free. And they are not compound.
Originally I was just using the lru member. Would it be ok in that
case?
next prev parent reply other threads:[~2021-04-05 21:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-05 20:37 [RFC 0/3] Group pages on the direct map for permissioned vmallocs Rick Edgecombe
2021-04-05 20:37 ` [RFC 1/3] list: Support getting most recent element in list_lru Rick Edgecombe
2021-04-05 20:37 ` [RFC 2/3] vmalloc: Support grouped page allocations Rick Edgecombe
2021-04-05 21:01 ` Dave Hansen
2021-04-05 21:32 ` Matthew Wilcox
2021-04-05 21:49 ` Edgecombe, Rick P [this message]
2021-04-05 21:38 ` Edgecombe, Rick P
2021-04-05 20:37 ` [RFC 3/3] x86/module: Use VM_GROUP_PAGES flag Rick Edgecombe
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=5cd26497530f153b0356f72ee016362e8db884cc.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hch@infradead.org \
--cc=jeyu@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=willy@infradead.org \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).