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=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 3E7A1C433DF for ; Fri, 21 Aug 2020 16:05:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 00BE3207BB for ; Fri, 21 Aug 2020 16:05:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TQeLM2ab" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00BE3207BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A2CFF8D0060; Fri, 21 Aug 2020 12:05:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DCAD8D0013; Fri, 21 Aug 2020 12:05:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F3178D0060; Fri, 21 Aug 2020 12:05:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by kanga.kvack.org (Postfix) with ESMTP id 7A7C28D0013 for ; Fri, 21 Aug 2020 12:05:54 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3D87C181AEF1A for ; Fri, 21 Aug 2020 16:05:54 +0000 (UTC) X-FDA: 77175051828.03.paint26_0d02dda2703a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 360B328A4E9 for ; Fri, 21 Aug 2020 16:05:44 +0000 (UTC) X-HE-Tag: paint26_0d02dda2703a X-Filterd-Recvd-Size: 5480 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Aug 2020 16:05:43 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id f193so1270132pfa.12 for ; Fri, 21 Aug 2020 09:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=wapcx/5Vbh5G639AQDnOiyGrJZXaNQ8MTw86eBzSth4=; b=TQeLM2abya+0luxj7HKY8kjrGpvsQOQb7hLsKu7wcSQ53pUVeHHBqDWbwhLpWqyCQo 2Hcyhj+QSe126y2yZWjYu2bxy+OXc6TG6xZd4dPFlk2d06V05bkGqBXUjQz1zcyJk/DP 651R54ipy9IstrkDRDpsqxm6PXlTD+1LxtS4CCEqaBQ4XR3ePQUtfIaDtR9UIJr8Do3A exbBJDmjDT4lfc5HjXehWx2SApo9psgKlC78TsTh7KBv81soMzOKrKf3ikGKmc6msDAl h+gYub/StWGMQSLC4a0Gdg+P6AW3PZrBA9uOaFSLhFSL/QEEZvclEg4V3SZiTawYiy2B AC2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=wapcx/5Vbh5G639AQDnOiyGrJZXaNQ8MTw86eBzSth4=; b=Z1+3gzN1FocPhB0K76/lED3IRjTtWQKQOVq3TuJXVKqn52bdOnQjtSR3NEM1m15Uri U2Ux8Pl7fE94CZFllaGQyp+oiM//tg9DeO11Ph96W59xOReYhmeTW4TH15qSB7iHPo2E KtWDady5BQYc7U1gc+6gwZheUG8La5a5j6Z30XCHbf/dh+0t/OEBix0R3Kf69oxEOLqS GoyaUam2kLa1qZFdWjecXxZ4jU1GALTspQND5vAiLD+rRkMRehzpYxoRPuHGc6bJ+izZ nf7qiS8nNqLH+rS/mzXOaCr3ZkY5oACDpHwE63B+Dk0eAW+WPFrTTpe6xBf+h5zzKEjw rnsA== X-Gm-Message-State: AOAM5321LJr7lrwA512Q2msBevfxpBaK2xldk493pIBQ1FRQJzvpUrUB BwZDh0K5O4lGOT5qEiaJk8c= X-Google-Smtp-Source: ABdhPJx/NdttpYzCAL4MKwJ9Rj5q/al1KK3HvjwJptRJw92UrEyk3IkxiX8LfzHQNcRQgmFKRKonmw== X-Received: by 2002:a63:5c8:: with SMTP id 191mr2708428pgf.244.1598025942564; Fri, 21 Aug 2020 09:05:42 -0700 (PDT) Received: from localhost (61-68-212-105.tpgi.com.au. [61.68.212.105]) by smtp.gmail.com with ESMTPSA id e26sm2920498pfj.197.2020.08.21.09.05.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 09:05:42 -0700 (PDT) Date: Sat, 22 Aug 2020 02:05:35 +1000 From: Nicholas Piggin Subject: Re: [PATCH v6 11/12] mm/vmalloc: Hugepage vmalloc mappings To: Andrew Morton , Eric Dumazet , linux-mm@kvack.org Cc: Christophe Leroy , Christoph Hellwig , Jonathan Cameron , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Zefan Li References: <20200821151216.1005117-1-npiggin@gmail.com> <20200821151216.1005117-12-npiggin@gmail.com> <1e001c2c-6c47-21a9-e920-caf78933b713@gmail.com> In-Reply-To: <1e001c2c-6c47-21a9-e920-caf78933b713@gmail.com> MIME-Version: 1.0 Message-Id: <1598025275.jd6s9py77x.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 360B328A4E9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: Excerpts from Eric Dumazet's message of August 22, 2020 1:38 am: >=20 > On 8/21/20 8:12 AM, Nicholas Piggin wrote: >> Support huge page vmalloc mappings. Config option HAVE_ARCH_HUGE_VMALLOC >> enables support on architectures that define HAVE_ARCH_HUGE_VMAP and >> supports PMD sized vmap mappings. >>=20 >> vmalloc will attempt to allocate PMD-sized pages if allocating PMD size = or >> larger, and fall back to small pages if that was unsuccessful. >>=20 >> Allocations that do not use PAGE_KERNEL prot are not permitted to use hu= ge >> pages, because not all callers expect this (e.g., module allocations vs >> strict module rwx). >>=20 >> This reduces TLB misses by nearly 30x on a `git diff` workload on a 2-no= de >> POWER9 (59,800 -> 2,100) and reduces CPU cycles by 0.54%. >>=20 >> This can result in more internal fragmentation and memory overhead for a >> given allocation, an option nohugevmalloc is added to disable at boot. >>=20 >> >=20 > Thanks for working on this stuff, I tried something similar in the past, > but could not really do more than a hack. > ( https://lkml.org/lkml/2016/12/21/285 ) Oh nice. It might be possible to do some ideas from your patch still. Higher order pages smaller than PMD size, or the memory policy stuff, perhaps. > Note that __init alloc_large_system_hash() is used at boot time, > when NUMA policy is spreading allocations over all NUMA nodes. >=20 > This means that on a dual node system, a hash table should be 50/50 sprea= d. >=20 > With your patch, if a hashtable is exactly the size of one huge page, > the location of this hashtable will be not balanced, this might have some > unwanted impact. In that case it shouldn't because it divides by the number of nodes, but it will in general have a bit larger granularity in balancing than smaller pages of course. There's probably a better way to size these important hashes on NUMA. I suspect most of the time you have a NUMA machine you actually would prefer to use large pages now, even if it means taking up to 2MB more memory per node per hash. It's not a great amount and the allocation=20 size is rather arbitrary anyway. Thanks, Nick