From: Chen Wandun <chenwandun@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <npiggin@gmail.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <edumazet@google.com>,
<wangkefeng.wang@huawei.com>, <guohanjun@huawei.com>,
<shakeelb@google.com>, <urezki@gmail.com>
Subject: Re: [PATCH v3 2/2] mm/vmalloc: introduce alloc_pages_bulk_array_mempolicy to accelerate memory allocation
Date: Thu, 28 Oct 2021 21:39:10 +0800 [thread overview]
Message-ID: <505c2aa3-2a36-3981-786e-4d192bc6f8f2@huawei.com> (raw)
In-Reply-To: <20211021202652.ff8568bd5d58fbcf32946f83@linux-foundation.org>
在 2021/10/22 11:26, Andrew Morton 写道:
> On Thu, 21 Oct 2021 16:07:44 +0800 Chen Wandun <chenwandun@huawei.com> wrote:
>
>> It
>
> What is "it"?
it == > [PATCH] mm/vmalloc: fix numa spreading for large hash tables;
>
>> will cause significant performance regressions in some situations
>> as Andrew mentioned in [1]. The main situation is vmalloc, vmalloc
>> will allocate pages with NUMA_NO_NODE by default, that will result
>> in alloc page one by one;
>>
>> In order to solve this, __alloc_pages_bulk and mempolicy should be
>> considered at the same time.
>>
>> 1) If node is specified in memory allocation request, it will alloc
>> all pages by __alloc_pages_bulk.
>>
>> 2) If interleaving allocate memory, it will cauculate how many pages
>> should be allocated in each node, and use __alloc_pages_bulk to alloc
>> pages in each node.
>
> This v3 patch didn't incorporate my two fixes, below. It is usual to
> incorporate such fixes prior to resending. I have retained those two
> fixes, now against v3.
>
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accelerate-memory-allocation-fix
>
> make two functions static
>
> Cc: Chen Wandun <chenwandun@huawei.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/mempolicy.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/mm/mempolicy.c~mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accelerate-memory-allocation-fix
> +++ a/mm/mempolicy.c
> @@ -2196,7 +2196,7 @@ struct page *alloc_pages(gfp_t gfp, unsi
> }
> EXPORT_SYMBOL(alloc_pages);
>
> -unsigned long alloc_pages_bulk_array_interleave(gfp_t gfp,
> +static unsigned long alloc_pages_bulk_array_interleave(gfp_t gfp,
> struct mempolicy *pol, unsigned long nr_pages,
> struct page **page_array)
> {
> @@ -2231,7 +2231,7 @@ unsigned long alloc_pages_bulk_array_int
> return total_allocated;
> }
>
> -unsigned long alloc_pages_bulk_array_preferred_many(gfp_t gfp, int nid,
> +static unsigned long alloc_pages_bulk_array_preferred_many(gfp_t gfp, int nid,
> struct mempolicy *pol, unsigned long nr_pages,
> struct page **page_array)
> {
> _
>
>
>
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accelerate-memory-allocation-fix-2
>
> fix CONFIG_NUMA=n build. alloc_pages_bulk_array_mempolicy() was undefined
>
> Cc: Chen Wandun <chenwandun@huawei.com>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/vmalloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/mm/vmalloc.c~mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accelerate-memory-allocation-fix-2
> +++ a/mm/vmalloc.c
> @@ -2860,7 +2860,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
> * otherwise memory may be allocated in only one node,
> * but mempolcy want to alloc memory by interleaving.
> */
> - if (nid == NUMA_NO_NODE)
> + if (IS_ENABLED(CONFIG_NUMA) && nid == NUMA_NO_NODE)
> nr = alloc_pages_bulk_array_mempolicy(gfp,
> nr_pages_request,
> pages + nr_allocated);
> _
>
> .
>
prev parent reply other threads:[~2021-10-28 13:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 8:07 [PATCH v3 0/2] fix numa spreading for large hash tables Chen Wandun
2021-10-21 8:07 ` [PATCH v3 1/2] mm/vmalloc: " Chen Wandun
2021-10-21 8:07 ` [PATCH v3 2/2] mm/vmalloc: introduce alloc_pages_bulk_array_mempolicy to accelerate memory allocation Chen Wandun
2021-10-22 3:26 ` Andrew Morton
2021-10-28 13:39 ` Chen Wandun [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=505c2aa3-2a36-3981-786e-4d192bc6f8f2@huawei.com \
--to=chenwandun@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=edumazet@google.com \
--cc=guohanjun@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@gmail.com \
--cc=shakeelb@google.com \
--cc=urezki@gmail.com \
--cc=wangkefeng.wang@huawei.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