Message ID | 20231219175046.2496-5-jszhang@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-5761-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2121525dyi; Tue, 19 Dec 2023 10:05:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNlNcQIvxm65CbSm1yuX/7bGKjLpVniX0rKACGRtPtBl7TuvBhJsC6rdjxFLUi04VeMaDa X-Received: by 2002:a9d:620c:0:b0:6d8:7d9e:5174 with SMTP id g12-20020a9d620c000000b006d87d9e5174mr526763otj.21.1703009123025; Tue, 19 Dec 2023 10:05:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703009123; cv=none; d=google.com; s=arc-20160816; b=B+ZdVIIGfQ37W+IeBWhZeFSOBJEPWtkfazJje26eCtKcKsXod2Nzmp/9Yuws+XQxAU D5+omphhEHE25yzbWUblszFOnuxXTHnho+HLydEKwKHhNZEYOdtLAzYQu7OF2LtXhICe 14b9o0T8L9Vjg72caWqHNiZvSaaLhaoJ1L1HCMPEz3Rj3t7Z1Y9wSZ9ObQZe+/G+CDw5 FrrIaayE04YJfWlc4u4rPZhU7gsbc4tshutHfJd+VfAsSbAqFYhpzGeNQMV/I27RKhvr si8Lcxfjxdlf6rgADFN1PrfH2lluflGkr03X9wqcOXstYC/4Br+27F7OLBTT7WZCk8iL smVw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5761-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id er6-20020a0568303c0600b006da4f8d0352si2924007otb.17.2023.12.19.10.05.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 10:05:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5761-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5761-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C8E7E2887B5 for <ouuuleilei@gmail.com>; Tue, 19 Dec 2023 18:04:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 365C13B194; Tue, 19 Dec 2023 18:03:37 +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 <jszhang@kernel.org> To: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Will Deacon <will@kernel.org>, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>, Andrew Morton <akpm@linux-foundation.org>, Nick Piggin <npiggin@gmail.com>, Peter Zijlstra <peterz@infradead.org> 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785734494460608017 X-GMAIL-MSGID: 1785734494460608017 |
Series | riscv: support fast gup | |
Commit Message
Jisheng Zhang
Dec. 19, 2023, 5:50 p.m. UTC
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 <jszhang@kernel.org>
---
arch/riscv/Kconfig | 1 +
arch/riscv/include/asm/pgtable.h | 6 ++++++
2 files changed, 7 insertions(+)
Comments
On 19/12/2023 18:50, Jisheng Zhang wrote: > 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 On which platform did you run this benchmark? > > The get time is reduced by 66.7%! IOW, 3x get speed! Well done! Thanks, Alex > > Signed-off-by: Jisheng Zhang <jszhang@kernel.org> > --- > 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));
On Sun, Dec 31, 2023 at 07:37:33AM +0100, Alexandre Ghiti wrote: > On 19/12/2023 18:50, Jisheng Zhang wrote: > > 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 > > > On which platform did you run this benchmark? T-HEAD th1520(cpufreq isn't enabled since the clk/pll isn't upstreamed, so cpu is running at the default freq set by u-boot) > > > > > > The get time is reduced by 66.7%! IOW, 3x get speed! > > > Well done! > > Thanks, > > Alex > > > > > > Signed-off-by: Jisheng Zhang <jszhang@kernel.org> > > --- > > 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));
On 02/01/2024 04:25, Jisheng Zhang wrote: > On Sun, Dec 31, 2023 at 07:37:33AM +0100, Alexandre Ghiti wrote: >> On 19/12/2023 18:50, Jisheng Zhang wrote: >>> 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 >> >> On which platform did you run this benchmark? > T-HEAD th1520(cpufreq isn't enabled since the clk/pll isn't upstreamed, > so cpu is running at the default freq set by u-boot) >> >>> The get time is reduced by 66.7%! IOW, 3x get speed! >> >> Well done! >> >> Thanks, >> >> Alex >> >> >>> Signed-off-by: Jisheng Zhang <jszhang@kernel.org> >>> --- >>> 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)); Thanks, you can add: Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Thanks, Alex > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
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));