From patchwork Mon May 6 15:51:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655670 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFB5FC25B5F for ; Mon, 6 May 2024 15:52:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28D106B008C; Mon, 6 May 2024 11:52:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 178F16B0092; Mon, 6 May 2024 11:52:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F330B6B0093; Mon, 6 May 2024 11:52:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D91FE6B008C for ; Mon, 6 May 2024 11:52:09 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 83950A07E6 for ; Mon, 6 May 2024 15:52:09 +0000 (UTC) X-FDA: 82088412378.19.AECF69F Received: from out0-218.mail.aliyun.com (out0-218.mail.aliyun.com [140.205.0.218]) by imf13.hostedemail.com (Postfix) with ESMTP id 48C3620010 for ; Mon, 6 May 2024 15:52:06 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=w+V0SPVu; spf=pass (imf13.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.218 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715010727; 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=TKTzSti+PtAcGWZfYR7jaBIBKKIAPqWETl5mtmtjZos=; b=NkzHq7gqFaFzTVOsGerjkejXMUzJg+aDY6p99xlLtnUlOxfL7Dkx0j7AZARJRy/LU9vbFa W3Um2xYnWiO9M9AANsHyZsfNRoyix2pXf5qOjBtgXWG5Dxy+t4/+UrZgp/JLMb5n4JC+8w QoPbrMVKUZx3IQ8p9y0eglbUMDtO4+U= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=w+V0SPVu; spf=pass (imf13.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.218 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715010727; a=rsa-sha256; cv=none; b=sGenDPgDpjWSQA8M5lRbJUUncLJhHL2/FN6Hj/mPD9EKTuUVHFkhNWwD/4Y+1TN+PEeV++ KTR79NfIW/PGXVlpQD/gjZ+BLmip3l4U0TF+ZpjpJr1GuHMfgvMvs1JMaSGnyVjwwwOhuc nvGrt2YKxmsFfhrLVmn405PH9V+RQIo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010724; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=TKTzSti+PtAcGWZfYR7jaBIBKKIAPqWETl5mtmtjZos=; b=w+V0SPVuonnfJf9NVwOnfJbb/mdo+nhnNuGiA/ZfDGzieFgOjoPCCrU7rFCbEvnUd0/G+Cm1gpIQ3eiZaAt/ywabQuNnULKp/sDCJQ/LiRxRaiTNclvzxsx768bHYzpmWYxS82kSDYVaFkWcTjfxi0z2UlgvD1CJbZOdsvR+fek= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047201;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTd3ClE_1715010722; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTd3ClE_1715010722) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:02 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 1/5] LoongArch: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:16 +0800 Message-Id: <20240506155120.83105-2-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-Stat-Signature: 5ujxaf7c4xm5icwk98dr6tmguq8jgsnf X-Rspam-User: X-Rspamd-Queue-Id: 48C3620010 X-Rspamd-Server: rspam05 X-HE-Tag: 1715010726-895686 X-HE-Meta: U2FsdGVkX18+eP3vJ4AEorI8FpL+XBwiUq17CdP8/QIA930TJZHg4QJ2t1UvhiBk/WbVnA5WtecPniDnaI1OA9Zy7F25aw8vd0aLtMobU9CqDFNyU2lH+HM0f3a42u328nhFPyS2sMmE2vJVU0O+IkrKfEmMZORCnTrHZPe6mjRJKN6qB94fg6EPdNixdwYCjph8iTtr4LFSQSU1zd/wLQDzlbAkdADwQse/c8QgUSmjBM8IHJaAOQ2DGAyLuZkuBH2FCLv8LzaFCmoqGTDmS6myAZhauRqm6N/1mZ7E9AwIux3NIMjIr2eftoJtRWnx5TfX3DkhVQqSm577aLbfAoFmF2g4Ufpdd3177s+6yHLs/vWSvhghUcJaADpRRQC7CFqPdhSfsLMKQixsgqHjy5UoGwCLeBRHegkbhUi7k3w08RhQ5N3//MjQt3eQRwFNrS+f34UYG0/sP2kGe0Etx5AxXZPboVOzLRusYZUip66pAvCt6ClexNsG2alxMczILOxZvJtx57cUYeM5x8wyqzSbhMpu1nU5JsvjX1FY50GnVEFZClLehuU7ctmjcpLBB91bAAVT+DZiFyi+8r1FksvVTt2A58vWx0HOFjUQqzAKJbPdVAKGNvlolvWEQfgyGVlbCbHbY3P945xAulM9MxDCp3KEJ9DIRvxvmAZiZePWjooxh6RqH/SdcaUoiilQDrgz45aZY1odmc5W7VYKEsXoHOPyN1EtabcOTPAtgSeRRulNuerru/qPx1mcdP5ep+Ki6Fmg9sYUzkvhyxddj5JNtdL77/fYUvkCmxCnue+6mDcMh2n92RXImAeJI1wt0UXPsV1dUJHeRleLc/sod1f0PYv8XU3uFs/90MfLNufiVrLiATON2/FZCe13RiSrKKXxiVn1AzM0wWiHO6u2eFy9qr/1aSInIg7aqLjfMNZlqTZL7wHpuuiFt0Q1iT/135Sxq66o1PE7G084Ejl 0/mXF6Bf RkriZmjyopj/d2ZUZICk4oLZGNjyuKGQIahpxdV5aR3S7u0yAttz44FxkUP7r6Uf3clB5NdI+3mBKvou4yllggRrhIfvHDeZ/jsiitxW+1W7AjtEmBNXbsn2U/QeHP41aU6ZyXcZdIV6mF4s2HAv6vERuA/h25vti4Y5MJG53LQ8nBYTvLCLt6PJhKIWuYW9vXBRvhL7CT9O88Sr4b3NSBXC3FO9hvtzChJmP5ndof1CwQp3QpcarVtwh+hVj2Gl4CV0FYq+VMMfQ0mLxjmRcKtJy7Zsk5c8iDAal1djCPwGAC+tj4jkLEYHgIi53obh4Gr8Bm6/DFRyzzp4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000808, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/loongarch/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h index af3acdf3481a..924b6b031f06 100644 --- a/arch/loongarch/include/asm/pgtable.h +++ b/arch/loongarch/include/asm/pgtable.h @@ -470,6 +470,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, addr, ptep, nr) \ + update_mmu_cache_range(NULL, vma, addr, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655671 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89127C10F16 for ; Mon, 6 May 2024 15:52:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A07FE6B0093; Mon, 6 May 2024 11:52:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 968376B0095; Mon, 6 May 2024 11:52:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BA1D6B0096; Mon, 6 May 2024 11:52:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5BFA26B0093 for ; Mon, 6 May 2024 11:52:11 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C4D5A1409F1 for ; Mon, 6 May 2024 15:52:10 +0000 (UTC) X-FDA: 82088412420.11.59AB2DD Received: from out0-197.mail.aliyun.com (out0-197.mail.aliyun.com [140.205.0.197]) by imf05.hostedemail.com (Postfix) with ESMTP id A38A2100010 for ; Mon, 6 May 2024 15:52:08 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=xPWae+Dt; dmarc=pass (policy=quarantine) header.from=antgroup.com; spf=pass (imf05.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.197 as permitted sender) smtp.mailfrom=libang.li@antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715010729; 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=pTrt2D6LnlSlcqnfLWOg4gAqNc+Zz7gJTsSV/QHl4Kk=; b=np+f4EBEO9QHX+82uLFQDSBZn6UzO7AQHbtRCYIwGE2xGNd64Vq19cfo+9NiCs4Mr7F3vK kVLpXcoGxOHqsJCVZ8lcLGUDEfIsXN86dzTx5OjutCOL5ssmEfC4oO293iWyO1pggM4dcu IfqskdLaa/HGTO6e+KvSVpD4Awke1s4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715010729; a=rsa-sha256; cv=none; b=6R05zcBDcoYDA6znTWuTxYxkYB8XbnqFRZNY1RXCgbbe8jJTMBG9xKjavoUsGUB38i9rRv IvHpq7K3lJdoZKKZJYkSVQeNrk40NEOsjl80swm4P5MQuOCbpeBdXoY7H8WWoOBdoN2o29 +4pk1gudqfG5zV5EXJzC3Sw8KWcfBvE= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=xPWae+Dt; dmarc=pass (policy=quarantine) header.from=antgroup.com; spf=pass (imf05.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.197 as permitted sender) smtp.mailfrom=libang.li@antgroup.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010726; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=pTrt2D6LnlSlcqnfLWOg4gAqNc+Zz7gJTsSV/QHl4Kk=; b=xPWae+Dt1L2DBXQL42txjiD9cEw/zfpTmB+q7ARqqSjO0+ruppKPoFCmWD796HDU4J11QFOMC7KYIEsNEG62HSrs+kIZR/bL6k8470OclwN6C3rfE4vwnvhmtVjR/R6hbOh6gy7skL6GftWAfSl1KKzg9+sUFwcXNMFPjpdUoYw= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047199;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTcewE9_1715010723; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTcewE9_1715010723) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:04 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 2/5] mips: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:17 +0800 Message-Id: <20240506155120.83105-3-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A38A2100010 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: puxdng6ytqdxauznqnw75qd1j6k4i7xi X-HE-Tag: 1715010728-512112 X-HE-Meta: U2FsdGVkX1+UgBRtg6I28AFL5nA+IZyrlpeZ175L9uewi5MAOmF6bQdRol83GnlE+GTxOzFZL1od0lrbEEbffFo8tjdNCKpr5hcsgeOplNzNJMeyn2KZKB8357zL4hJ6czHtBW5g/SaJDatBtbytjN9X1NfneVuq71kv1u34MCd/LVBlKvOaIY9nzuHOEx6nEQNSB7/eBhoe1WmcKTWq9gKjafKGm7G8578pn+U9CVF3nHdgzHWb5sCkM2Jfa4SkQE/32gQc/nxDgVWLKEK7V+nnb/NnOmd+iXqp0e2qGw7yvBGRk7abP5HOVXZpG3fLZriGGj2KLrOiULJpaDPmzyAkfgPFAKcCpm03vNssB8vkODs0fDuFO/ImRmvupyKurUQXjVvXAhvYcBmtCSIVMfMvyVDtKXac/gQeKiy1P1FT1NPrMbgyL5RItC39ye6BsX/MfefrKaatr917hfpBvKAvEX4WFGeQHsdi8lpgbNuW+ylFiq7mIvFeOXQgaq6QO8csnYGhwDwRDu89egrRPh8tvnjIZm1+kweLPzS+ZX6hC4QtMqg39SN8A80XUycssyP6M20T39BabaGdMTkDK+EdCxMYz6r2FBzCfBnoTQcymiFak12Hh9ZC8h8OyJOZ73+4DmQpCJrcng3mjvqMn5G2WxK9FxWir6fL+7fy0JNnKEDmQjLfZcgYdo4agzegCgZgX60+cdaoNhmrWyQxaIgMmHuv91cSygFmok21A97gfEvnr/dufUi+IkO2BnCv1oySNFIz5eseCerGTmuKFbVtFKxkg/PgKseMddWKo7YgMBRFdRfteofK4MX+ea/YnXvvk97Jzh2PUZEI9y2uVHAdK573IKB5SOr/a1b17CFbyz8b7ViDIbw9Ukeufby5PLIjs2OxqKrK+Aix2vaaY36rdE41lX+Dpd33x/yors+HB1idywVQaU3XvyX0mCJWMygzgUgeQVS2HJWY643 bFdXmZsv 2WdUyA3G5TCX+Z9OfOQP5N+ZeKfLl7bTVZk79U2CXSwFhKkYK8gMCw6Ijd1ONDS5Fh/20Hh6wKy/HQcHx7CNkLBKOAdnRMkubLhPcTXTKwVc3GPcFxArN8C0ssLPmFvokG+XXaCras67VZmZK1HBxvJlE6aQfLg/uPkAfBn09v4YKJTkyZECjC8+SK+fr3v9l7vsK351jc3iTgRo77DsDy4VrCSbTnh/lqwb5UvpoYrBfbRpozZkmddlhTqyLw5eGNO0uti0D4Fqro5F8q9kn0Zkm/bCgyBYxJ0ouVIb/wyaUIe2vJ7qKcwGK1ZmtiQsAi5WGhLC/G95bikmyXeMNKEBawQnz2x9NT4P/B2HuJ3ZI8gA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000449, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/mips/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index e27a4c83c548..9416c9b971e5 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -597,6 +597,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, address, ptep, nr) \ + update_mmu_cache_range(NULL, vma, address, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655672 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CCD5C10F16 for ; Mon, 6 May 2024 15:52:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7990C6B0095; Mon, 6 May 2024 11:52:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F6DD6B0096; Mon, 6 May 2024 11:52:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FC356B0098; Mon, 6 May 2024 11:52:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2D6256B0095 for ; Mon, 6 May 2024 11:52:13 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D5B42C05F8 for ; Mon, 6 May 2024 15:52:12 +0000 (UTC) X-FDA: 82088412504.17.D5D9BC0 Received: from out0-209.mail.aliyun.com (out0-209.mail.aliyun.com [140.205.0.209]) by imf06.hostedemail.com (Postfix) with ESMTP id 5F78818002A for ; Mon, 6 May 2024 15:52:10 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=S9oTuP+n; spf=pass (imf06.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.209 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715010731; 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=V5hA+ZyI44gZD58G2AfJieyG2gwT3Fy83Cv7WPpLrX0=; b=ri9ZSt38/CxLg3F22Vb86mZrZMkmeYDbpQHSCkSmZmo2xKcem+ITFA889hxtv+TsIkA/Vw yN/hRs5jkIIzBcXMN6aldZWggRZkGdcyxY2SYW5VvwqFH3Awn5OhaSt3+S/Z1bfUywhFHs iGiMiZ+rreDbKH0TC0Ar9NzN2wSSzYI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=S9oTuP+n; spf=pass (imf06.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.209 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715010731; a=rsa-sha256; cv=none; b=PRJ2K0jWm029o8r2VoU/SahfZLic8iVT+KEhhLAQ36YLF1w+1KOBpsAf0OtuxX6Sb2oWRX qsV66P2y+u1NU/oCUNXLaJG8vmJqzKKHaE7AB47qW1eYVPbF/Q09qWYeGQfbsTu+itngCK 86qJNLGBTZAapogF6p0qdig8DxUpTPM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010727; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=V5hA+ZyI44gZD58G2AfJieyG2gwT3Fy83Cv7WPpLrX0=; b=S9oTuP+nQD10do/2vkQ3olR0poUtTfOxwDHVI2RZVzDa/xJtKK27IhmdocDtfjzR8PtRCveERAcTKN8siXTh+ZyMHWnoFhhOtwGPAQORJTXU924L0CoodAdKqnDipXyJmi9pAGCe7hHcBcUfBbKaeL0IPtR20CGXuVjaVX35lls= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047202;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTd3Clf_1715010725; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTd3Clf_1715010725) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:06 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 3/5] riscv: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:18 +0800 Message-Id: <20240506155120.83105-4-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-Stat-Signature: 5fc8ke6khq9rwut9e6bmgpi5ea3x6qqp X-Rspamd-Queue-Id: 5F78818002A X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1715010730-528448 X-HE-Meta: U2FsdGVkX1/8FVXC+AQFfznHhIY8EdSdd4+aAk/GmeEOV/tW4tDgjHVsC9ve8ylTrygdjKepGtwlMwAYp6S8owNEzOFhaPP02nJPWTnv30kki96MKnWf0Yfa8bJIyQ/6LFK19UgHKpNimo2H6nef0ZrMiMiSS9jKFvatVikhBKNVAQ+MVLkZiIpznAgigJv3pHJU7FbslcWQvSlbpPT1iVyc23eNbQWLbA1pGYm8iTBpFBUaezIC5nvNMSpUOnYCRoMgiPL2QQGmmmBU86OAHkgk1jlkawb8o2GYhV8uA+McmTCYd/7y/ZJl5Gk7HjqL/8NSUgSIEQPYB5VDO4Rtgr3jqSgpEGsipEWB7Us2FpHV1xgHsSsNc6OaDo61v8nvx93kYgdTesogvRZFJUkCAdSuXXnE5lFqE7oihEiYNWnlgZDft3t+X67IiI27YTqJ16Y+OKW5eXJQY8mSNpUCs0MEoAqIR0IyCyj0tJBL5Bf/hPRy7C3DrdumiDC9OI4kixO4BQ2MvWQVn15rsRjQk9HVvNmX0e0vmiC9P5J1ngQQzSqAGyZSr/TBIfKm5pUpwN+YWFgmqsYxB3OLnTICAP/IisvO6cViYpx4kltKcf1pZcSHWJ/CZ8TiHHeK6dULwq5DRz87CuFLawrarh3weHZMuurY+JtDF57WefYhD6Q+Cdqrlfr8UmGzgw34qpNWzd4vJF+upeTMTrpEB6w/2Ycw0035navrCPEcrwhCZxHqoSnf0KjMaaTsJBg5i20RWpRJ+h6vrI/lpCvEKVe1kVYZDkF4MQS3Oc3O38UO1rfUJCvC/zLQrgp0ifhP1DqkgcE8hgi157SzL6PMvwfZZcAq6cvnpl/ndbLyn5iGypAaL3ranj3pID2rgSo9TxMwheG4qYxFfT37BYesfpiF63VOXb8GpR7wGvYVuPKqkg/KrCCiMUr2Ka8Jg6uoh7FhyFtYhOWv6Qx4e84eW8z D4F/9mJZ H+duuLND7QbUWYxUNAqlDL70Ek7j2MqYQuUb5Z4u8irm/25o5hAlcMkzxRjR66pVvSA4rqRSrLt7MyzVoZ8folwOS00mFoQX3xyEGGWXYhGDuvdM+/mPKomOtcnfeEpxlpESOIp//T0RXEEU+iO4y/baS2ec/omhM4nb/DpwEeyxjh0pDKUmkfR1W9oPRuz6Mc2sXspMPBEdqd7O6ReJ48sCwG0etkHjqQOaSzW0L2g3Y/p52f4H/aGy8M9pFtmlUYSSLTssZ/i+2Bcmt+B3nhe176tVZkJFOkNMoGjfEpmrZ/gn3G+p7l3EsdjGZVIkY5h19jf62I5J3Au0lOmWDAOH0WYs9LjmAkAbiUpW67PMYR4c= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000022, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li Reviewed-by: Alexandre Ghiti --- arch/riscv/include/asm/pgtable.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 661b2b4fe758..f784c6dd2c66 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -489,6 +489,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#define update_mmu_tlb_range(vma, addr, ptep, nr) \ + update_mmu_cache_range(NULL, vma, addr, ptep, nr) + static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { From patchwork Mon May 6 15:51:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655673 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE75C10F16 for ; Mon, 6 May 2024 15:52:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 583396B0098; Mon, 6 May 2024 11:52:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4AED56B0099; Mon, 6 May 2024 11:52:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FF816B009A; Mon, 6 May 2024 11:52:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 08A5D6B0098 for ; Mon, 6 May 2024 11:52:15 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 84D381A096D for ; Mon, 6 May 2024 15:52:14 +0000 (UTC) X-FDA: 82088412588.09.8186059 Received: from out0-215.mail.aliyun.com (out0-215.mail.aliyun.com [140.205.0.215]) by imf07.hostedemail.com (Postfix) with ESMTP id 7C10D40019 for ; Mon, 6 May 2024 15:52:12 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=aStQqaZO; spf=pass (imf07.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.215 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715010732; 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=fZLMp0zX1lVO/AMMqpo0KyiatSIXbG3CSPTawlIjnSU=; b=BXSPLeYIJsDy5f8Nmr1gPHttB6uBQmcgt1tzBD1sjCvWreSSJTG6yBz5MGLgG2XD4n/xXt 2XMQawLw8F26m52jQOFMB/t1y/NsM1qyAAyGmSsLPVNh0fKPCOS5gTpc+BPG7RmIq8uM+y IoH5pGSOukbVklDiGfy/DGqSWzac0ao= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=aStQqaZO; spf=pass (imf07.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.215 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715010732; a=rsa-sha256; cv=none; b=DKrYcJZzv1u/qhyBoFDagAVpzOCo3HKBiQmHsYtS/2527AKI57Hx250koJN307Z+W3khvn eu1jtf18C0WgU9OAPHg5gUdy57/qAoX7kigczsegLwpCBJcpL9j1++5WtcJxaZeJcw5b5H qPFKkUiGIX9x4cvwnQRArtjMJrWm6oA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010729; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=fZLMp0zX1lVO/AMMqpo0KyiatSIXbG3CSPTawlIjnSU=; b=aStQqaZOohz35DRBGFMCkuopRx0Plzkaz7/qx/bdVjo8Z3vieMhz0bKgcYtSB3MSv42bZluAWutG9ZcN1lAHQXvu/dimpoYpg8FAaPm0hX56hBb0HlPKkx5ot72wKBB7NNSwt41xrpgKJOPIK+8l+pwoTe2eXDixpsbXlBzeH4U= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R331e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047192;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTcewEm_1715010727; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTcewEm_1715010727) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:08 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 4/5] xtensa: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:19 +0800 Message-Id: <20240506155120.83105-5-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 7C10D40019 X-Rspamd-Server: rspam06 X-Stat-Signature: s3cdscrpsi8hotbjpz5hfmm6p7jbka4m X-HE-Tag: 1715010732-104615 X-HE-Meta: U2FsdGVkX1//zx5louM1hsZ0mFDUlULLoNMmp2arZAMSztQ6gF7n6varEvrhuXKLqBxO0uWiaaGHYqj92R+oLzuKCxya2TB+RFbOk+zg4ssqyOx4gjF32tXCXy0wf/nGBtbsrPkxO7aeThKOuiCZ9J3kPByeohM8LLZvnOo69z8Ws2kKRO7oCn70bueDd9Hdr4G9Oot5X+j+I+I77ku4jDGDRTmYvb+vQzmANA6XZg9i53l7QPAbavCulkE+dUxUoZuURJ7NXEXm4SAsfsnA1nmLSCauyPbrvplQCDmL69Z40QG+X8dd1KnmgHXBetY+wGIBtnodMcZ7y4aCIuiBP1dANfqj091qZlIbq4WHpaZUxyoFdKD4Ihgg3wIs8M0Gj/Qc7P4UienY9xcl8gNEUZMKNZ73DrBebYfIbq2+sKSSPaP7f/2DQT848N9ABdmaxDD2N0Mz3qva695TqcurL0TVlf8iBETlCO1f7VXLp+XRc1+qK+J9DTC3TObzT+51tQKA/jYcEYNMhICVDo3ZFq75u72HPjf70xieaiLwrJrE6Yg5FRdkbDkJbSbOS6Hv9XtUsnSj+8mDgYoTl2Z0GU3I4GcW4IqZBS0OBtwsArhHnMAZehvJjAqe+agVjL9Ac9leTcXw4ebl5IJcIKDevmt/DeudftI7jbRM2bcpvTB63XE7oc/JNOoIltmZnP0/EpmkGGiCgT0ZubgQxnu6nRefiROJUP1ML8EyQlACHX36GTKhQdkwBctWQ+SAAQyJrLUYisfCeAjNFOL/55E16QHoilZjeNYqwGUv1FJX9ERb9iZ6Fo3LnO9napq5bWin5YkpIDkcFn5u2Tddk/0oErtt31L/3XqnuKEhEDJ8xHm3n6xdWcPCr7MfaE3M/r/GHWP6NmLukoozNfgn5o6Ws04skgbAYK7BnDzjOWBdFkIz+cWij7k3w1G+TC7fcYQxIPM9qCq4x8ban/wHN9u gM1Xr7sC jemL2WElNSU0zR5JHCXGWFypx+sUB/Qgv4kV/qmdIjO2WfjHXgPWeQcVkKmxAZmI3gptiXf6pdjnTGKa+vhTZIleUAR2djUXMwdVV05TOgdt9pXtwqAz6wZZ23kBp6eITKchybPwAUq/BGHa+M4avcZ1hJP/t3Q6RguLPcSLcqxUMdjsM4mYGPoG+orBqtwepvaxG1cP4lK2ZGcXDj0l8ZQLQluZL7aGYobgf9v072g9+4iZDDxn6qU04QCfyTSeJDkdGrwmzUU4UMMuOb9/09ELtu+0sMCBHZmVYuPEU6WkheTvGTjCMctON6LWRnNrwuT0olZ+oJXbpMqqCPJTfAJ45RU+zyma8XINBPSJOUUMJj6w= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000040, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/xtensa/include/asm/pgtable.h | 4 ++++ arch/xtensa/mm/tlb.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 9a7e5e57ee9a..57f97e7e06d0 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h @@ -414,6 +414,10 @@ void update_mmu_tlb(struct vm_area_struct *vma, unsigned long address, pte_t *ptep); #define __HAVE_ARCH_UPDATE_MMU_TLB +void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr); +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE + #endif /* !defined (__ASSEMBLY__) */ #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c index d8b60d6e50a8..05efba86b870 100644 --- a/arch/xtensa/mm/tlb.c +++ b/arch/xtensa/mm/tlb.c @@ -169,6 +169,12 @@ void update_mmu_tlb(struct vm_area_struct *vma, local_flush_tlb_page(vma, address); } +void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr) +{ + local_flush_tlb_range(vma, address, address + PAGE_SIZE * nr); +} + #ifdef CONFIG_DEBUG_TLB_SANITY static unsigned get_pte_for_vaddr(unsigned vaddr) From patchwork Mon May 6 15:51:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13655674 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BD15C25B4F for ; Mon, 6 May 2024 15:52:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DC916B009A; Mon, 6 May 2024 11:52:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 264D06B009B; Mon, 6 May 2024 11:52:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08F026B009C; Mon, 6 May 2024 11:52:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DAAFD6B009A for ; Mon, 6 May 2024 11:52:18 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5F8C6A164B for ; Mon, 6 May 2024 15:52:18 +0000 (UTC) X-FDA: 82088412756.29.E7D9CBA Received: from out0-209.mail.aliyun.com (out0-209.mail.aliyun.com [140.205.0.209]) by imf29.hostedemail.com (Postfix) with ESMTP id 59ABC12000C for ; Mon, 6 May 2024 15:52:15 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=MJ9JpeGQ; spf=pass (imf29.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.209 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715010736; 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=ymFvshx88TI9/EMP30aaqBdjrnITBbXYS6oOftHtOBQ=; b=a4IqdN6SKg9pJu7iXkPmmptbjeOJTEnmhXcHnr0X9AihZD9uE5yaJprkcS/npODxxgcFM5 yOJMdMqQTeJPsWCzhwR5sT3/tHvZ+6n/N+gkwSD5Vl0Ofo6NGJwg7098lIYHVNzRyCJwEA eqbBUlgwOglYpFFG+FLLQKsPy9RvhMo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715010736; a=rsa-sha256; cv=none; b=BavUb6u5Y0UiLVWrthRGwjwZ72+jPKlQVTU781gCLq+OS1bT5YBsvVBfSTHIbSJ9yuPiQH raCQVTWC9d4niOq/X5wAjj1kSnNg0A4ZXLWxDcaji7/ld3jzWWUPdYg82nncXSGWUCfvuI uyBLpWkDdZWDCk+zHkRjJUla1ieqYJA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=antgroup.com header.s=default header.b=MJ9JpeGQ; spf=pass (imf29.hostedemail.com: domain of libang.li@antgroup.com designates 140.205.0.209 as permitted sender) smtp.mailfrom=libang.li@antgroup.com; dmarc=pass (policy=quarantine) header.from=antgroup.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1715010732; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ymFvshx88TI9/EMP30aaqBdjrnITBbXYS6oOftHtOBQ=; b=MJ9JpeGQL1WuHbhx6kehn4UM7BwvjbskZc3LoYDnUohCrbpgNkDvzrm3P9Po5u+agT3bbPe4nYjQ3hhPSVy/pSFb5CdRnnH+WsL84AnapTR3mc2AqfGBf2WYsil7wXVEiR8yJDiR7xKrJ1EwYLnnWLDdE5RlaGXGMsamYUDE7lg= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047198;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XTf7qIH_1715010729; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XTf7qIH_1715010729) by smtp.aliyun-inc.com; Mon, 06 May 2024 23:52:10 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v2 5/5] mm: Add update_mmu_tlb_range() Date: Mon, 06 May 2024 23:51:20 +0800 Message-Id: <20240506155120.83105-6-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240506155120.83105-1-libang.li@antgroup.com> References: <20240506155120.83105-1-libang.li@antgroup.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: py38hjdksx3scec3xjbkfae5p9454ein X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 59ABC12000C X-HE-Tag: 1715010735-39860 X-HE-Meta: U2FsdGVkX18srtGNdn4SL/N6mUPq8nwtoN/5OY+ZC9SsWqumg0srI6KLxF8rHEGo/61UuG6i4z7iA3rZ1wwMl5eLVujMQeG2j/fnZbiWb9VsIuZavxfksB/uxFUCjeUOzGAxDhcvF1tByL1aaioe/pQ+UzHSKAvpV0W2R3nZWffq3VImRNwR5ShTUh5cSUgjtbFCJwmfQ5YO4f9h44T4wa0Q2XTOhxw+2lKD/YAPu65za+oGWWeT25isAV/gr9Vr0R8iU66NW/8dLA4oyvfiUTT2X7Zuly8xXGV4MgNptPzqMlF8sv8RCxiI7CDJFDJEO1EUfhd8ZNxPQwdgoyOMj7LUggnX9vqCFxWIMLN2K2BNlEYd0lsVF+YJZ1V+a4nOF1IJS9Ge+/yH9FDiXTmHLYcE4gTpTJgNwmAECrhUhj7TNA6IKUWXiXI0gZeLkbyqqqwuHSG8mIhnOgHUdJEiwNieoYDZoU+JUZSmE7crrYjdMybNYfb4dHTJ5lae89j+0E4ex3sGaK0CVi2plkfLaAeZvOmoWUYki0/MVJBZfUNCTWXqZz4+Sr5LefUZSOljmve4yxlaTjk9fFNm02w/Pa+3zZvNTRnbDggjL7VDv+DTaukUNnaSWtfakTcNVybAioElnZ2KjgGJVEXect8LcPFf3YVBCMYgJfNM1zisLtk4F2QR+0ux/ooKZvw6Jq/yzsnduI0LdzArNFWdPsRXMwbGG8cmlqrijj74xmwixqIN2MbKWlnF9UyEDKPhuhF4h2lswnZ/8U4Q1c75Dbb8rw6qpYFNs3K5LXTtM3En36UL/DJs2SO5h8lS9/q7yTJrrx2NoNAbpllmVV1E6Pa/qNI4PCYJX0uqMmiUtcsaUmEHuirs35TChmUoc1pj3HtOarcRGz/MEI7h3wgQMeERdVSooLkTcIlYGxKcck17CcsZodhgWyonydtNH8Dn9ywt1wyBHosJmNnPHvBqT3S zO39K16N 9V54yvURld4AVPr+LvQUMy1iFzrEQLYjgNq/gAiU46eNQzHez5e6S5zbR+ipv9w5P9MUzwpmfuhRmVpeuDjNfYZEnBjGfAXjARuD5FaA997YOsA9Ihbi7dlaTaMrnDQMZcrEMsnrqSVgRzHMTZikACXfyDBJRoqGBiKXmAndZZqtxZa8dYtN6jh8HJOVWxrVL/cUHEN7OcVR0tfEJWLIblI8fqzPwHXqSyzXtQjBBrrwMJjctKla6fX82wnbF4GgJG6ywzuUNezt7InsR8GVX8nd+6Rd0JTPF7xJ+rroz8Bi0RBRaQ/BuFYbAOe4YQBBcD4MYFUWVfRfel+Q= 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: List-Subscribe: List-Unsubscribe: After the commit 19eaf44954df ("mm: thp: support allocation of anonymous multi-size THP"), it may need to batch update tlb of an address range through the update_mmu_tlb function. We can simplify this operation by adding the update_mmu_tlb_range function, which may also reduce the execution of some unnecessary code in some architectures. Signed-off-by: Bang Li --- include/linux/pgtable.h | 8 ++++++++ mm/memory.c | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 18019f037bae..869bfe6054f1 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -737,6 +737,14 @@ static inline void update_mmu_tlb(struct vm_area_struct *vma, #define __HAVE_ARCH_UPDATE_MMU_TLB #endif +#ifndef __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +static inline void update_mmu_tlb_range(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep, unsigned int nr) +{ +} +#define __HAVE_ARCH_UPDATE_MMU_TLB_RANGE +#endif + /* * Some architectures may be able to avoid expensive synchronization * primitives when modifications are made to PTE's which are already diff --git a/mm/memory.c b/mm/memory.c index eea6e4984eae..2d53e29cf76e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4421,7 +4421,6 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) vm_fault_t ret = 0; int nr_pages = 1; pte_t entry; - int i; /* File mapping without ->vm_ops ? */ if (vma->vm_flags & VM_SHARED) @@ -4491,8 +4490,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) update_mmu_tlb(vma, addr, vmf->pte); goto release; } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { - for (i = 0; i < nr_pages; i++) - update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); + update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); goto release; }