Message ID | 20230711075434.10936-3-alexghiti@rivosinc.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 399E5EB64DC for <linux-mm@archiver.kernel.org>; Tue, 11 Jul 2023 07:56:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A29D48E0001; Tue, 11 Jul 2023 03:56:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D9798D0001; Tue, 11 Jul 2023 03:56:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A1A58E0001; Tue, 11 Jul 2023 03:56:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7D1BB8D0001 for <linux-mm@kvack.org>; Tue, 11 Jul 2023 03:56:42 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4939A120149 for <linux-mm@kvack.org>; Tue, 11 Jul 2023 07:56:42 +0000 (UTC) X-FDA: 80998574244.12.6DEE092 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by imf26.hostedemail.com (Postfix) with ESMTP id 6FDE1140005 for <linux-mm@kvack.org>; Tue, 11 Jul 2023 07:56:40 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=Qf1MDi4I; spf=pass (imf26.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689062200; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FofimiyN+7gyzGEdPyrBP2skR/4a1H3RZbKcHwnJwCU=; b=0S4PjUgNX6xKN4n5OEsQNcksm+oSQ4RefzK6BX3mzrxpHV5hcl+rxDSzOVT5Oc+4Urljpm 0+th5zuQYRU2b2DG0X3A1g//XVf8gGemBDJqipcAlJa4ohLoXLyj249X9D7qjQgKM8z+Kg XVOEDU1renDFVKKFDANkHM2+JEle4kM= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=Qf1MDi4I; spf=pass (imf26.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689062200; a=rsa-sha256; cv=none; b=fsyk0pc5Im5GrIY7lyInrN/uKBOMR/DTkVOffBi4O5UloYWlOqmjIvALDzTh9X8/oXo9R3 pO62yYBVZKnOE7H+p+ezpqg6gsc+10w5RHelCCSSRzzS1PdYK45wI/owOZb0Mq6InGBYyS SWpoNLBaV9yUbWVuNQr7BQap11L7Rns= Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-31438512cafso5831003f8f.2 for <linux-mm@kvack.org>; Tue, 11 Jul 2023 00:56:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1689062199; x=1691654199; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FofimiyN+7gyzGEdPyrBP2skR/4a1H3RZbKcHwnJwCU=; b=Qf1MDi4IQVSgi+mVmNSDLBvvWhfd8ba6Ayo48Gj0+fuhQZ4V9G61dBcMO//cFS1/fC eMTYYy06UvyotO+oVGCBq6zI9sY1LeYU01nJRoZJ+JLckfsVKJMM97nPklKyDZRE3HOu TVkWiZ1s6BeKrYLS2wuPUnzE9wyBrK5LdHaTtNHXVs67A6vQfZbIP4oSE43hkg/e5u/I R82FjYAOaShi8TnwHOG++346KF4aekyWodyFCqKGj8HPeSDtbX8x88W80pqGP3MBU7wD 2AUgLCJEZ6IWj8TTYNHFpXz8+pCuX+wIU15tPfBynjH9x67d68/tJq305rfx6T581tDJ NCkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689062199; x=1691654199; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FofimiyN+7gyzGEdPyrBP2skR/4a1H3RZbKcHwnJwCU=; b=jLeN6jkG3BvvoI0HbONesv5g2mwRNOpEFT/ZwbbzPwiZFSzMcJ10fRCq808ttPfzT1 VtgC1UkVgC3OL38HGRoVteT/UUcm/Lm112DorKMFEj8ww3h6bcg1eAL+RPKnea92m7re Ufo4RPyUQSlbva0ga9o3pA8IXwnue0WsLpt/dmAcajsR0BE9AvCMiy++KWntfsOJPWNF guxQwxalTvFTHjg53wUhjdmJZCvspYFtXV5vA4Xdd0P63NS0Q2fbctB0/nplc6CPlPPg NomtKEt5Yxbz2SJUK2iPCN7K1kc+dM+RBCZxqSS/ULWFwVl2TGq7uCtbhcgwchwsVPQF N9gw== X-Gm-Message-State: ABy/qLZIK/Pvz0y+LsB0j/V+Ww3kmpPNLHJRgY2tHOMK93v48gZSZ9a0 nQDTxK/97NVrc/L0hf4cayHBhA== X-Google-Smtp-Source: APBJJlFgOrHK/zRfOp0MLvbYM0U1zfW7SDksh40rSfKhwgzyv7cSwo1z6lrEN1sxG+rtuvh+ttt+lA== X-Received: by 2002:adf:f052:0:b0:30a:a15d:eb2f with SMTP id t18-20020adff052000000b0030aa15deb2fmr16274589wro.3.1689062199178; Tue, 11 Jul 2023 00:56:39 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id p8-20020adfe608000000b003141f3843e6sm1489099wrm.90.2023.07.11.00.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 00:56:39 -0700 (PDT) From: Alexandre Ghiti <alexghiti@rivosinc.com> To: 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>, Mayuresh Chitale <mchitale@ventanamicro.com>, Vincent Chen <vincent.chen@sifive.com>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Subject: [PATCH 2/4] riscv: Improve flush_tlb_range() for hugetlb pages Date: Tue, 11 Jul 2023 09:54:32 +0200 Message-Id: <20230711075434.10936-3-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230711075434.10936-1-alexghiti@rivosinc.com> References: <20230711075434.10936-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6FDE1140005 X-Rspam-User: X-Stat-Signature: t3z87xnro94kby4g4r8g79eeir9gtiw6 X-Rspamd-Server: rspam01 X-HE-Tag: 1689062200-66949 X-HE-Meta: U2FsdGVkX1+s+bgmGi43ogOyl8TDKuVgKpNdV4nF2gal1m9L/yqqPhSjqUnZbUhYegB1am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2W0HQbKNkGc6Dt/4f03ofw1SvmB7Zco/ZB3YNvNXh11VA8KLn5hE1/eD8ktRdk5oQdikOR6hHSuYZNiOXmIg771sBl1XppO2u8IRixHfdMLMvWeReDRA8njg4dhcLGzvcVx85Lpo+QG9d3Ewf7nUyE3CM3wVQtsHcRuwM5pB2ekDlRefopHPxkW/kB8/gZYOJFDEYpxjS7hb5Ge5suI83bSSpBsV2sGHnMHSuFUgRe3uI4u4t3a74z6abW7uQbEamdBWWFdH7MTx4/N7uBdr68BgWnU3YqW6EwhqKdi6DNXpHRTlXgKz4JvzbUbAi+FePZergBOEPYca2RcioOXLGZ5LdKZR5w== 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: <linux-mm.kvack.org> |
Series |
riscv: tlb flush improvements
|
expand
|
diff --git a/arch/riscv/mm/tlbflush.c b/arch/riscv/mm/tlbflush.c index fa03289853d8..3e4acef1f6bc 100644 --- a/arch/riscv/mm/tlbflush.c +++ b/arch/riscv/mm/tlbflush.c @@ -3,6 +3,7 @@ #include <linux/mm.h> #include <linux/smp.h> #include <linux/sched.h> +#include <linux/hugetlb.h> #include <asm/sbi.h> #include <asm/mmu_context.h> @@ -147,7 +148,14 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { - __flush_tlb_range(vma->vm_mm, start, end - start, PAGE_SIZE); + unsigned long stride_shift; + + stride_shift = is_vm_hugetlb_page(vma) ? + huge_page_shift(hstate_vma(vma)) : + PAGE_SHIFT; + + __flush_tlb_range(vma->vm_mm, + start, end - start, 1 << stride_shift); } #ifdef CONFIG_TRANSPARENT_HUGEPAGE void flush_pmd_tlb_range(struct vm_area_struct *vma, unsigned long start,
flush_tlb_range() uses a fixed stride of PAGE_SIZE and in its current form, when a hugetlb mapping needs to be flushed, flush_tlb_range() flushes the whole tlb: so set a stride of the size of the hugetlb mapping in order to only flush the hugetlb mapping. Note that THPs are directly handled by flush_pmd_tlb_range(). Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> --- arch/riscv/mm/tlbflush.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)