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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 264C6C433E0 for ; Mon, 25 Jan 2021 12:14:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 63839224F9 for ; Mon, 25 Jan 2021 12:14:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63839224F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9B6DE8D0002; Mon, 25 Jan 2021 07:14:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 967978D0001; Mon, 25 Jan 2021 07:14:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88C5B8D0002; Mon, 25 Jan 2021 07:14:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 719068D0001 for ; Mon, 25 Jan 2021 07:14:20 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 29E128249980 for ; Mon, 25 Jan 2021 12:14:20 +0000 (UTC) X-FDA: 77744189880.13.dolls18_0e01b8f27585 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id D31731813F3EE for ; Mon, 25 Jan 2021 12:14:05 +0000 (UTC) X-HE-Tag: dolls18_0e01b8f27585 X-Filterd-Recvd-Size: 5370 Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Jan 2021 12:14:04 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DPTLF5mjtz9tytf; Mon, 25 Jan 2021 13:13:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id fjwqXeu-7KdQ; Mon, 25 Jan 2021 13:13:57 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4DPTLF4vfBz9tytY; Mon, 25 Jan 2021 13:13:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 06A1A8B79B; Mon, 25 Jan 2021 13:14:03 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id g4AmfjdBibuV; Mon, 25 Jan 2021 13:14:02 +0100 (CET) Received: from [172.25.230.103] (po15451.idsi0.si.c-s.fr [172.25.230.103]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B35128B75F; Mon, 25 Jan 2021 13:14:02 +0100 (CET) Subject: Re: [PATCH v10 11/12] mm/vmalloc: Hugepage vmalloc mappings To: Nicholas Piggin , Andrew Morton , linux-mm@kvack.org Cc: Ding Tianhong , Christoph Hellwig , Jonathan Cameron , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Zefan Li , Rick Edgecombe References: <20210124082230.2118861-1-npiggin@gmail.com> <20210124082230.2118861-12-npiggin@gmail.com> <933352bd-dcf3-c483-4d7a-07afe1116cf1@csgroup.eu> <1611574637.k9njsi2um5.astroid@bobo.none> From: Christophe Leroy Message-ID: Date: Mon, 25 Jan 2021 13:13:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <1611574637.k9njsi2um5.astroid@bobo.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr 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: Le 25/01/2021 =C3=A0 12:37, Nicholas Piggin a =C3=A9crit=C2=A0: > Excerpts from Christophe Leroy's message of January 25, 2021 7:14 pm: >> >> >> Le 24/01/2021 =C3=A0 09:22, Nicholas Piggin a =C3=A9crit=C2=A0: >>> Support huge page vmalloc mappings. Config option HAVE_ARCH_HUGE_VMAL= LOC >>> enables support on architectures that define HAVE_ARCH_HUGE_VMAP and >>> supports PMD sized vmap mappings. >>> >>> vmalloc will attempt to allocate PMD-sized pages if allocating PMD si= ze >>> or larger, and fall back to small pages if that was unsuccessful. >>> >>> Architectures must ensure that any arch specific vmalloc allocations >>> that require PAGE_SIZE mappings (e.g., module allocations vs strict >>> module rwx) use the VM_NOHUGE flag to inhibit larger mappings. >>> >>> When hugepage vmalloc mappings are enabled in the next patch, this >>> reduces TLB misses by nearly 30x on a `git diff` workload on a 2-node >>> POWER9 (59,800 -> 2,100) and reduces CPU cycles by 0.54%. >>> >>> This can result in more internal fragmentation and memory overhead fo= r a >>> given allocation, an option nohugevmalloc is added to disable at boot= . >>> >>> Signed-off-by: Nicholas Piggin >>> --- >>> arch/Kconfig | 10 +++ >>> include/linux/vmalloc.h | 18 ++++ >>> mm/page_alloc.c | 5 +- >>> mm/vmalloc.c | 192 ++++++++++++++++++++++++++++++------= ---- >>> 4 files changed, 177 insertions(+), 48 deletions(-) >>> >> >>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c >>> index 0377e1d059e5..eef61e0f5170 100644 >>> --- a/mm/vmalloc.c >>> +++ b/mm/vmalloc.c >> >>> @@ -2691,15 +2746,18 @@ EXPORT_SYMBOL_GPL(vmap_pfn); >>> #endif /* CONFIG_VMAP_PFN */ >>> =20 >>> static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp= _mask, >>> - pgprot_t prot, int node) >>> + pgprot_t prot, unsigned int page_shift, >>> + int node) >>> { >>> const gfp_t nested_gfp =3D (gfp_mask & GFP_RECLAIM_MASK) | __GFP_= ZERO; >>> - unsigned int nr_pages =3D get_vm_area_size(area) >> PAGE_SHIFT; >>> - unsigned long array_size; >>> - unsigned int i; >>> + unsigned int page_order =3D page_shift - PAGE_SHIFT; >>> + unsigned long addr =3D (unsigned long)area->addr; >>> + unsigned long size =3D get_vm_area_size(area); >>> + unsigned int nr_small_pages =3D size >> PAGE_SHIFT; >>> struct page **pages; >>> + unsigned int i; >>> =20 >>> - array_size =3D (unsigned long)nr_pages * sizeof(struct page *); >>> + array_size =3D (unsigned long)nr_small_pages * sizeof(struct page *= ); >> >> array_size() is a function in include/linux/overflow.h >> >> For some reason, it breaks the build with your series. >=20 > What config? I haven't seen it. >=20 Several configs I believe. I saw it this morning in=20 https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210124082230.21= 18861-13-npiggin@gmail.com/ Though the reports have all disappeared now.