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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9C79C433EF for ; Mon, 27 Dec 2021 15:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5b2YHwcNUwXaOx3PJBiFXLnaOkO3ySyz+axaqb53PGw=; b=Cq3N1gChh7P+1foO2Sd3isz0BC xeFqMGigPaCJlKlcPBLo9KrZsaZ0ednBzHFznMOZTjgmBSZO62LwkpzvqgFYynSzUaHl3tr0aPV4B bl7yBvozwiFaqWInZypOZNmjyUnFv5e90rAvXbDvf9Ndfd7Nt40morqI5OQ9pnmoR7tPeRHTWSfLz tGTDHJTzIQlmOliuDgPpkYSoBBmQPUuPt1NBIpH/dKX731rVa3spPt7C1z9xrB/S3unxOMPCnoLy1 WXx3WpKMs0J2ZX5pZ/qfuhdFVg7ne6cS/KuJatFVDofioDEqJuNDngiswap2cigF9IWy9jKTJyP5r IwUxQgNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1sMI-00GwMZ-JQ; Mon, 27 Dec 2021 15:56:22 +0000 Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1sMF-00GwLy-2V for linux-arm-kernel@lists.infradead.org; Mon, 27 Dec 2021 15:56:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1640620579; x=1672156579; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=Qopi0GCbZb8D3tqnGHATwO1hv9M0cdIa+FRZv6opEto=; b=mA8JfAq98MSebpNPd0N25WbtomnvUi1gC0reSgwWY4TI2gyIznp0zNnA rrOWPkXPRH17919M9Myv716HGM6710j2y+lvU5GiqVS6iVSo/6b7sgu+m qbAJpAL2ZtcdQGi2buoJs8Z8ph0RGOq/SJpabv3jsc1gfN5cMIeg1oy5X c+QnCkPxTbaB1GQYchX4qfunQNSKh7guYNdOWVI/o/YsVb4YKltWZQjJt E9puXvXcARsoVVmjkhpQJ10jMxlkeA3EGVFCBVb6l4ZUIGwqKeced2XbW FL0gDUnXyVB7lrVWH0Y0m+3iPqmm2AdBiRso+Lf5pK0HAy2QE6/UpchKJ g==; X-IronPort-AV: E=McAfee;i="6200,9189,10209"; a="304585208" X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="304585208" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:17 -0800 X-IronPort-AV: E=Sophos;i="5.88,239,1635231600"; d="scan'208";a="486053937" Received: from dannysua-mobl2.amr.corp.intel.com (HELO [10.212.232.47]) ([10.212.232.47]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2021 07:56:16 -0800 Subject: Re: [PATCH v2 3/3] x86: Support huge vmalloc mappings To: Kefeng Wang , Jonathan Corbet , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org Cc: Nicholas Piggin , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Christophe Leroy , Matthew Wilcox References: <20211227145903.187152-1-wangkefeng.wang@huawei.com> <20211227145903.187152-4-wangkefeng.wang@huawei.com> From: Dave Hansen Message-ID: <70ff58bc-3a92-55c2-2da8-c5877af72e44@intel.com> Date: Mon, 27 Dec 2021 07:56:14 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211227145903.187152-4-wangkefeng.wang@huawei.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211227_075619_225891_30C9B0DD X-CRM114-Status: GOOD ( 22.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 12/27/21 6:59 AM, Kefeng Wang wrote: > This patch select HAVE_ARCH_HUGE_VMALLOC to let X86_64 and X86_PAE > support huge vmalloc mappings. In general, this seems interesting and the diff is simple. But, I don't see _any_ x86-specific data. I think the bare minimum here would be a few kernel compiles and some 'perf stat' data for some TLB events. > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 95fa745e310a..6bf5cb7d876a 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -75,8 +75,8 @@ void *module_alloc(unsigned long size) > > p = __vmalloc_node_range(size, MODULE_ALIGN, > MODULES_VADDR + get_module_load_offset(), > - MODULES_END, gfp_mask, > - PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, > + MODULES_END, gfp_mask, PAGE_KERNEL, > + VM_DEFER_KMEMLEAK | VM_NO_HUGE_VMAP, NUMA_NO_NODE, > __builtin_return_address(0)); > if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { > vfree(p); To figure out what's going on in this hunk, I had to look at the cover letter (which I wasn't cc'd on). That's not great and it means that somebody who stumbles upon this in the code is going to have a really hard time figuring out what is going on. Cover letters don't make it into git history. This desperately needs a comment and some changelog material in *this* patch. But, even the description from the cover letter is sparse: > There are some disadvantages about this feature[2], one of the main > concerns is the possible memory fragmentation/waste in some scenarios, > also archs must ensure that any arch specific vmalloc allocations that > require PAGE_SIZE mappings(eg, module alloc with STRICT_MODULE_RWX) > use the VM_NO_HUGE_VMAP flag to inhibit larger mappings. That just says that x86 *needs* PAGE_SIZE allocations. But, what happens if VM_NO_HUGE_VMAP is not passed (like it was in v1)? Will the subsequent permission changes just fragment the 2M mapping? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel