Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4088713rwd; Mon, 29 May 2023 23:43:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6k3At7XIbLNHLRqQBqJPuVG4jC22RVyh7GYTVEivXmpOFAZ0g0UvGPd5xWaT0y0gR19AH1 X-Received: by 2002:a05:6a20:7491:b0:10f:7e62:3806 with SMTP id p17-20020a056a20749100b0010f7e623806mr1673263pzd.22.1685429014647; Mon, 29 May 2023 23:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685429014; cv=none; d=google.com; s=arc-20160816; b=lKruuhhIrTI4lcUxWA0BQUPZ+8LPTzkiepafMI4JU/TrditVpnqHfjsMfUdFkXcu0F uOXBvpbniSngUJcFWmy+nEQHK+1CUEf5OnwwGBdFdPqcX/blaMaqYtDPkAZYv/W3E6qY 1WlvSbQLfB2FQNyqX677HnRX7LeFKhVHCsBEZWGsWyeErrsHPyzxBYe5/BShTml6TFze fSbL0xRyO+p964A7eNeEFEQAWklBmL20xOp8tBx9nBBJxqDexOnKeNpP65Rkne49S47/ wRJ4ody4obekxjB9z8MiePCJY4Xgydialf5ldKtPYE8pseGLg5CWO3leCrMsGTMFzauX rSeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=SsEFykTTr1Y+kZYyRqrdoefiJQaCTMcgpE7uD+V55Ow=; b=yvKDr90koYIgqrTQ2KmTRxWebrmyKZYL0AvjnVIpbh19tYy4678jkT8mFINAXvD80H Qo41Fbl1Gle/2WmyAYHvgjsCXwf+767Ln7/7xYwq5FHTwT027/yU/hIKeKCEZ+GOZ5JQ HXK7RxsbXu0Udb5bUZqH/Y1OqNhdck9/eP5Ka/X8mSXC3oZd5zN2Q6BZQ2YrPn1Q25XK H6kz4l3Qt+P3xdWCm8wUVFpepVjFzwdrJ0bd23IvRYh4s+rjOivqOK98mZ069vh0DdeP B7B4uFFWDNwdcLPDtxHpGEiCBqnd5YDcoWao6Yp8pJ2jrR/g7Dox5Nm09qSHOUBZMPhI RWow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OWDqbvWl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs64-20020a632843000000b0053f66c75b98si5427702pgb.703.2023.05.29.23.43.20; Mon, 29 May 2023 23:43:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OWDqbvWl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbjE3GhX (ORCPT + 99 others); Tue, 30 May 2023 02:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjE3GhW (ORCPT ); Tue, 30 May 2023 02:37:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41875B2 for ; Mon, 29 May 2023 23:37:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6F9F62A92 for ; Tue, 30 May 2023 06:37:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4C60C433EF; Tue, 30 May 2023 06:37:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685428640; bh=SsEFykTTr1Y+kZYyRqrdoefiJQaCTMcgpE7uD+V55Ow=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=OWDqbvWlIm7OcMQaGlT+EtXnC54BfSzGWgOzgp5j/7ydS/dewMezjQOwRKCHPIOHe TL051HGjO/RDOZjAL0Y+hLp1zKulj0+SdesJUstAg7+V1AYaACvbwkWZOFwyOLoquG awMoPUgNJ8SVHbU98ceJNJxa+JjwbY8tOzQtF2AMzz0d8qRkmgx9DpmFFTa3dZ5zl1 zp0pnAAu8cf8xuN/gn/mMGXQo3SsfxZT5anmzHl+FPItlPFjQv/g+hIRFpHqmMMIDZ ykHwy9qcqwBUlDwGHk7LUvgSux9HeyHuTv2yp/sv4ee1+ADOPUQeky9Us0pLZNu0XU NMy7pb6+v+YLA== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Cc: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux@rivosinc.com, Alexandre Ghiti , Joerg Roedel Subject: Re: [PATCH] riscv: mm: Pre-allocate PGD entries vmalloc/modules area In-Reply-To: <20230529180023.289904-1-bjorn@kernel.org> References: <20230529180023.289904-1-bjorn@kernel.org> Date: Tue, 30 May 2023 08:37:17 +0200 Message-ID: <871qiyfhpe.fsf@all.your.base.are.belong.to.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bj=C3=B6rn T=C3=B6pel writes: > From: Bj=C3=B6rn T=C3=B6pel > > The RISC-V port requires that kernel PGD entries are to be > synchronized between MMs. This is done via the vmalloc_fault() > function, that simply copies the PGD entries from init_mm to the > faulting one. > > Historically, faulting in PGD entries have been a source for both bugs > [1], and poor performance. > > One way to get rid of vmalloc faults is by pre-allocating the PGD > entries. Pre-allocating the entries potientially wastes 64 * 4K (65 on > SV39). The pre-allocation function is pulled from J=C3=B6rg R=C3=B6del's = x86 > work, with the addition of 3-level page tables (PMD allocations). > > The pmd_alloc() function needs the ptlock cache to be initialized > (when split page locks is enabled), so the pre-allocation is done in a > RISC-V specific pgtable_cache_init() implementation. > > Pre-allocate the kernel PGD entries for the vmalloc/modules area, but > only for 64b platforms. > > Link: https://lore.kernel.org/lkml/20200508144043.13893-1-joro@8bytes.org= / # [1] > Signed-off-by: Bj=C3=B6rn T=C3=B6pel ...and the build was bitten by nommu [1]. I'll hold off the v2 a bit, to see if there's any other comments. Bj=C3=B6rn [1] https://patchwork.kernel.org/project/linux-riscv/patch/20230529180023.2= 89904-1-bjorn@kernel.org/