From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "luto@kernel.org" <luto@kernel.org>,
"Hansen, Dave" <dave.hansen@intel.com>,
"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>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>
Cc: "daniel@iogearbox.net" <daniel@iogearbox.net>,
"ast@kernel.org" <ast@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"andrii@kernel.org" <andrii@kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"hch@infradead.org" <hch@infradead.org>
Subject: Re: [RFC 2/3] vmalloc: Support grouped page allocations
Date: Mon, 5 Apr 2021 21:38:22 +0000 [thread overview]
Message-ID: <95a608e850a66af2add6ffcdeb5c6b5c057f1002.camel@intel.com> (raw)
In-Reply-To: <971aae01-32a0-3f45-1810-010e3295b1c4@intel.com>
On Mon, 2021-04-05 at 14:01 -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.
Yes sorry, that deserved more explanation. I tried putting it in struct
page actually. The problem was list_lru automatically determines the
node id from the list_head provided to it via
page_to_nid(virt_to_page(head)). I guess it assumes the list_head is on
the actual item. I started adding another list_lru function that let
the node id be passed in separately, but I remembered this trick from
the deferred free list in vmalloc.
If this ever expands to handle direct map unmapped pages (which would
probably be the next step), the list_head will have to be moved out of
the actual page anyway. But in the meantime it resulted in the smallest
change.
I can try the other way if it's still too weird.
next prev parent reply other threads:[~2021-04-05 21:38 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
2021-04-05 21:38 ` Edgecombe, Rick P [this message]
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=95a608e850a66af2add6ffcdeb5c6b5c057f1002.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=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 read-only IMAP folder(s) and NNTP newsgroup(s).