From: Dennis Zhou <dennisszhou@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>,
Daniel Borkmann <daniel@iogearbox.net>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] percpu: add __GFP_NORETRY semantics to the percpu balancing path
Date: Thu, 15 Feb 2018 17:10:27 -0600 [thread overview]
Message-ID: <20180215231027.GA79973@localhost> (raw)
In-Reply-To: <20180215213909.GU695913@devbig577.frc2.facebook.com>
Hi Tejun,
On Thu, Feb 15, 2018 at 01:39:09PM -0800, Tejun Heo wrote:
> On Thu, Feb 15, 2018 at 10:08:15AM -0600, Dennis Zhou wrote:
> > -static struct pcpu_chunk *pcpu_create_chunk(void)
> > +static struct pcpu_chunk *pcpu_create_chunk(gfp_t gfp)
> > {
> > const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT;
> > struct pcpu_chunk *chunk;
> > struct page *pages;
> > int i;
> >
> > - chunk = pcpu_alloc_chunk();
> > + chunk = pcpu_alloc_chunk(gfp);
> > if (!chunk)
> > return NULL;
> >
> > - pages = alloc_pages(GFP_KERNEL, order_base_2(nr_pages));
> > + pages = alloc_pages(gfp | GFP_KERNEL, order_base_2(nr_pages));
>
> Is there a reason to set GFP_KERNEL in this function? I'd prefer
> pushing this to the callers.
>
Not particularly. As I wasn't sure of the original decision to use
GFP_KERNEL for all percpu underlying allocations, I didn't want to
add the gfp passthrough and remove functionality.
> > diff --git a/mm/percpu-vm.c b/mm/percpu-vm.c
> > index 9158e5a..ea9906a 100644
> > --- a/mm/percpu-vm.c
> > +++ b/mm/percpu-vm.c
> > @@ -37,7 +37,7 @@ static struct page **pcpu_get_pages(void)
> > lockdep_assert_held(&pcpu_alloc_mutex);
> >
> > if (!pages)
> > - pages = pcpu_mem_zalloc(pages_size);
> > + pages = pcpu_mem_zalloc(pages_size, 0);
> ^^^^
> because this is confusing
Yeah.. The next patch removes this as the additional gfp flags is weird.
> > static int pcpu_alloc_pages(struct pcpu_chunk *chunk,
> > - struct page **pages, int page_start, int page_end)
> > + struct page **pages, int page_start, int page_end,
> > + gfp_t gfp)
> > {
> > - const gfp_t gfp = GFP_KERNEL | __GFP_HIGHMEM;
> > unsigned int cpu, tcpu;
> > int i;
> >
> > + gfp |= GFP_KERNEL | __GFP_HIGHMEM;
> ^^
> double space
>
I'll fix this with any other updates.
> So, setting __GFP_HIGHMEM unconditionally here makes sense because
> it's indicating the types of pages we can use (we also accept high
> pages); however, I'm not sure GFP_KERNEL makes sense. That's about
> "how to allocate" and looks like it should be left to the caller.
>
That makes sense, I can remove the forced GFP_KERNEL use in the next
patch as that patch moves the flags to the caller.
I'd rather be explicit though and whitelist GFP_KERNEL as I don't have a
full grasp of all the flags. Our use case is a little different because
we ultimately become the owner of the pages until the chunk is freed. So
there are certain flags such as __GFP_HARDWALL (poor example), the
difference between GFP_KERNEL and GFP_USER, which don't make sense here.
Regarding high pages, I think you're referring to GFP_ATOMIC
allocations? We actually never allocate on this path as allocations must
be served out of parts of chunks that are already backed.
Thanks,
Dennis
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2018-02-15 23:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 16:08 [PATCH 0/3] percpu: introduce no retry semantics and gfp passthrough Dennis Zhou
2018-02-15 16:08 ` [PATCH 1/3] percpu: match chunk allocator declarations with definitions Dennis Zhou
2018-02-15 16:39 ` Christopher Lameter
2018-02-15 16:08 ` [PATCH 2/3] percpu: add __GFP_NORETRY semantics to the percpu balancing path Dennis Zhou
2018-02-15 21:39 ` Tejun Heo
2018-02-15 23:10 ` Dennis Zhou [this message]
2018-02-16 18:07 ` [PATCH v2 " Dennis Zhou
2018-02-15 16:08 ` [PATCH 3/3] percpu: allow select gfp to be passed to underlying allocators Dennis Zhou
2018-02-15 21:41 ` Tejun Heo
2018-02-15 23:17 ` Dennis Zhou
2018-02-16 18:09 ` [PATCH v2 " Dennis Zhou
2018-02-18 13:33 ` Tejun Heo
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=20180215231027.GA79973@localhost \
--to=dennisszhou@gmail.com \
--cc=cl@linux.com \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tj@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).