From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 576BBC433EF for ; Thu, 28 Oct 2021 13:39:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DAC2261056 for ; Thu, 28 Oct 2021 13:39:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DAC2261056 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 40A0E6B0071; Thu, 28 Oct 2021 09:39:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BB056B0072; Thu, 28 Oct 2021 09:39:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A9846B0073; Thu, 28 Oct 2021 09:39:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 04EAA6B0071 for ; Thu, 28 Oct 2021 09:39:18 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7A6DA39BBC for ; Thu, 28 Oct 2021 13:39:18 +0000 (UTC) X-FDA: 78745952796.32.BB33387 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf24.hostedemail.com (Postfix) with ESMTP id 51E25B0000B1 for ; Thu, 28 Oct 2021 13:39:16 +0000 (UTC) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Hg67d1vZPz8tVn; Thu, 28 Oct 2021 21:37:49 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 28 Oct 2021 21:39:12 +0800 Received: from [10.174.178.178] (10.174.178.178) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 28 Oct 2021 21:39:11 +0800 Message-ID: <505c2aa3-2a36-3981-786e-4d192bc6f8f2@huawei.com> Date: Thu, 28 Oct 2021 21:39:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [PATCH v3 2/2] mm/vmalloc: introduce alloc_pages_bulk_array_mempolicy to accelerate memory allocation To: Andrew Morton CC: , , , , , , , References: <20211021080744.874701-1-chenwandun@huawei.com> <20211021080744.874701-3-chenwandun@huawei.com> <20211021202652.ff8568bd5d58fbcf32946f83@linux-foundation.org> From: Chen Wandun In-Reply-To: <20211021202652.ff8568bd5d58fbcf32946f83@linux-foundation.org> Content-Type: text/plain; charset="UTF-8"; format=flowed X-Originating-IP: [10.174.178.178] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected X-Stat-Signature: 5qjezx8tkxkj6ha96djzdadbjitfn994 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 51E25B0000B1 Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of chenwandun@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=chenwandun@huawei.com X-HE-Tag: 1635428356-457627 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: =E5=9C=A8 2021/10/22 11:26, Andrew Morton =E5=86=99=E9=81=93: > On Thu, 21 Oct 2021 16:07:44 +0800 Chen Wandun = wrote: >=20 >> It >=20 > What is "it"? it =3D=3D > [PATCH] mm/vmalloc: fix numa spreading for large hash tables; >=20 >> 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. >=20 > 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. >=20 >=20 > From: Andrew Morton > Subject: mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accel= erate-memory-allocation-fix >=20 > make two functions static >=20 > Cc: Chen Wandun > Cc: Eric Dumazet > Cc: Hanjun Guo > Cc: Kefeng Wang > Cc: Nicholas Piggin > Cc: Shakeel Butt > Cc: Uladzislau Rezki (Sony) > Signed-off-by: Andrew Morton > --- >=20 > mm/mempolicy.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > --- a/mm/mempolicy.c~mm-vmalloc-introduce-alloc_pages_bulk_array_mempol= icy-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); > =20 > -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; > } > =20 > -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) > { > _ >=20 >=20 >=20 >=20 > From: Andrew Morton > Subject: mm-vmalloc-introduce-alloc_pages_bulk_array_mempolicy-to-accel= erate-memory-allocation-fix-2 >=20 > fix CONFIG_NUMA=3Dn build. alloc_pages_bulk_array_mempolicy() was unde= fined >=20 > Cc: Chen Wandun > Cc: Eric Dumazet > Cc: Hanjun Guo > Cc: Kefeng Wang > Cc: Nicholas Piggin > Cc: Uladzislau Rezki (Sony) > Signed-off-by: Andrew Morton > --- >=20 > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > --- a/mm/vmalloc.c~mm-vmalloc-introduce-alloc_pages_bulk_array_mempolic= y-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 =3D=3D NUMA_NO_NODE) > + if (IS_ENABLED(CONFIG_NUMA) && nid =3D=3D NUMA_NO_NODE) > nr =3D alloc_pages_bulk_array_mempolicy(gfp, > nr_pages_request, > pages + nr_allocated); > _ >=20 > . >=20