Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp92105rdb; Tue, 19 Dec 2023 10:10:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFy7UOU/l6nNrkyRxYr4zc3wNR83fQFu886fz8epFlKNTWMKH5+RgQ87RAuV/rpQnYqX5QY X-Received: by 2002:a17:90a:c394:b0:28b:bbc0:c555 with SMTP id h20-20020a17090ac39400b0028bbbc0c555mr1822138pjt.8.1703009448154; Tue, 19 Dec 2023 10:10:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703009448; cv=none; d=google.com; s=arc-20160816; b=LNTbKNMhERrHIP5nJhteEwG/jHaxak98XXZiwxoQkL8jPZwG1pWhzfSuYC0uNzbN88 WCok1cRkFegg7ju7G+eIkcouNdOJCn7SKAvLD3MlncaSxWQp+IST+TZqZRx2UvJNYIQI LPwFj54ClhTn4rMDcM5z/1UsZ7pRnxVReliOqtjUSpWtwxxwwx8sOlxF6uLlFXz7j7pv 2zSHYsvufry/f1EOQkR0FYLb1rupHDuT+uby/2qq/0OUBSDML9vyU6JTZ0BU9404NaaQ UYpAV9726a7HSvNCM+OoLRbKNWHUCSbsdYw2xI6HyMHyKsqhMmjW6jQK+C5tLhzZHcxE gZbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZOfv5mqPVoNjWH7q2gBw3BsdWC6ZGwg86MfP6BHLzRA=; fh=0Glk/ayqI8+vZzfC3nNOQX076ObCaIyGiP/4knLjRm0=; b=kWGIxeg8Z9UZPwMqZAmdb7wNMV2425IQcDX/u2omZ2CGpuJ3+8tVrVd1NOq0yHSZW4 PNWiYWvzJtm6JuFO3lgVXy/AgQDSo4cslc0tmMXfi1LWwCOWU694b0NzAhvNycNi927J ylpD1mD048Ac9U7hplt4zOeyASOIrQtreXAmcR2snHO1V1NO05rU8dnSgZhNqTuhLX7z UAIIFxfE9gAB+3F4L0EwYHDFaYdaKUl9b+urOd2g1/z5FCtgPbIthU9RbhxKmYs0vCsQ ktJWgzuEOGCCMATBwKU3lNyEk/Tjt+XCyObvYLJFBpLL3KjNWkgEoBjg6oWTgCetfKkQ MF9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="BvEJaO/t"; spf=pass (google.com: domain of linux-kernel+bounces-5761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k25-20020a63ba19000000b005cdba9aa36esi1250435pgf.733.2023.12.19.10.10.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 10:10:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="BvEJaO/t"; spf=pass (google.com: domain of linux-kernel+bounces-5761-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5761-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E725AB23427 for ; Tue, 19 Dec 2023 18:04:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9DDD39AFE; Tue, 19 Dec 2023 18:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BvEJaO/t" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C394739AE7; Tue, 19 Dec 2023 18:03:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01013C433CC; Tue, 19 Dec 2023 18:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703009013; bh=jOzh15UGY8/GeKyvzomEjUoOApjigEX2YDPvhINsBhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvEJaO/t7fLRI9ME+g6Nf2uKvBFzhDxeGVkHtu0GNM/cuRLsGbH1Dn5794sKOGhX7 t2neLuWSxp8mcJ6f0iqpeVhqi4qYZ8ahPfVqN2Da62LUO4i/t7gL4bmvdBqH64Llyn QkRpi8dmIk/b/s2jltgElLVpM3vEGAMoladx4fbNv3xbFj5qlDKciiWQ+lStLf8ju1 pub/Wz86s+HQWQ3Ve18yw7Zyy0EcvOkhR8zgpWpEnigIMCNNdI7HcIC4rkQ9U2GhTK L7bquPxY+IC1hy+VduUcpRaujnplUMl8dZNy79gV5MHb1aIEYQXoOGfUkVwIpLYaME gcTZZsxBtN4Pg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/4] riscv: enable HAVE_FAST_GUP if MMU Date: Wed, 20 Dec 2023 01:50:46 +0800 Message-Id: <20231219175046.2496-5-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20231219175046.2496-1-jszhang@kernel.org> References: <20231219175046.2496-1-jszhang@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Activate the fast gup for riscv mmu platforms. Here are some GUP_FAST_BENCHMARK performance numbers: Before the patch: GUP_FAST_BENCHMARK: Time: get:53203 put:5085 us After the patch: GUP_FAST_BENCHMARK: Time: get:17711 put:5060 us The get time is reduced by 66.7%! IOW, 3x get speed! Signed-off-by: Jisheng Zhang --- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/pgtable.h | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index d3555173d9f4..04df9920282d 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -119,6 +119,7 @@ config RISCV select HAVE_FUNCTION_GRAPH_RETVAL if HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION select HAVE_EBPF_JIT if MMU + select HAVE_FAST_GUP if MMU select HAVE_FUNCTION_ARG_ACCESS_API select HAVE_FUNCTION_ERROR_INJECTION select HAVE_GCC_PLUGINS diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index ab00235b018f..c6eb214139e6 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -673,6 +673,12 @@ static inline int pmd_write(pmd_t pmd) return pte_write(pmd_pte(pmd)); } +#define pud_write pud_write +static inline int pud_write(pud_t pud) +{ + return pte_write(pud_pte(pud)); +} + static inline int pmd_dirty(pmd_t pmd) { return pte_dirty(pmd_pte(pmd)); -- 2.40.0