From patchwork Mon Apr 29 10:33:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13646581 Received: from out0-198.mail.aliyun.com (out0-198.mail.aliyun.com [140.205.0.198]) (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 CA8B14778E; Mon, 29 Apr 2024 10:36:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386964; cv=none; b=pOnzPUDZbJ0x2XHkTljB8MwlGBNO505JEHlD2s6XPhUnVrz7FJZYHnUJOXhwzr+1lQOujHrBQDsVlfYIOU72uA7lnoyM3bsbhGaMcTNH8VmET/CfRBwkJfwqiwvgJiCAVIQYsLF/An+v7A2uaK1juXwQBdKeum2HUPbeCOnyJNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386964; c=relaxed/simple; bh=kik5XO6svGpEoUGKapTye8QDGY88f/SLWUpm40ED15Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XmstYwuazKCo1KpWRlRrk5X8ctjXBREH5pfr/myHHpR92YAVyEN830t0aBB16LvvKoZRZ0r6j7D5rjqo+PU5mRAKWrcuhhe3L0aTXjxp8bMVBZFiHj9sso0YJOK87zZS9u5gZmFlCIwTowx6sIt1zUvqqOZF0NY+CI2YK2OiOsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=WiL+qiQq; arc=none smtp.client-ip=140.205.0.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="WiL+qiQq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1714386954; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=6Lf/KTNGeV9HQ9Bw8oLzpkcGoRQJ7Qoem8o9ZsWDa00=; b=WiL+qiQq5ggcx6KKouoOmmZdbRu4tyn6tVR+PSDU5+g4LD/aG7bh/F+kWEy0F1E9p8rWRXZiHBUAWW7PX579FC6dQiUgUk9xNK2yMzX3LUka9AgQPSqlKtbMXXHD0AU+0AS1Mpo/4+vlWn3JfM9lNMp2eHNxyknvhk/ymbLEbnc= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047203;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.XOEanKl_1714386951; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XOEanKl_1714386951) by smtp.aliyun-inc.com; Mon, 29 Apr 2024 18:35:52 +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 v1 1/5] LoongArch: Add update_mmu_tlb_range() Date: Mon, 29 Apr 2024 18:33:42 +0800 Message-Id: <20240429103346.59115-2-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240429103346.59115-1-libang.li@antgroup.com> References: <20240429103346.59115-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h index af3acdf3481a..5ccc2a3a6f7a 100644 --- a/arch/loongarch/include/asm/pgtable.h +++ b/arch/loongarch/include/asm/pgtable.h @@ -469,6 +469,8 @@ 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 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 Apr 29 10:33:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13646582 Received: from out0-206.mail.aliyun.com (out0-206.mail.aliyun.com [140.205.0.206]) (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 259DE35F18; Mon, 29 Apr 2024 10:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.206 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386966; cv=none; b=acbc/wo9NHGpUG5bVSXnRvfRt1FNo/WXPgrRp6oQRWe4qt3rbXdP088gvM26Jzzhh59A06sX0r9fha5AVGRqZB5kspnQInPpQZYcdoiCp3Z823i/eoGTw4tQs4/PZNHZsCr8OryqwBh4xgEqEBDLczBxRdB3HsbvCsY0T7594GA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386966; c=relaxed/simple; bh=jxXWxShuCRotVk/KOZsP3/ma7cHvuzHRC6adnl/VgTU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=e3yqUIZWQCGLYbuuoGscBTrNVYDPFmr8zAQoSWUZTP0kyJZwVGipsrQygYbA9pRnIIa7QLCG6DTga0H2v05IuYIOuiP6NO7ZM7z5X53qq+FqQ3n2ycjLd/ErPL9KAiI74CI90jOP9SvhNKhTF0ySQKlqya7BWGuFxTpzDKrynTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=ZfDEYM1g; arc=none smtp.client-ip=140.205.0.206 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="ZfDEYM1g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1714386956; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Zpq+IlpQptIiF+1qadAYLdyILX4yq5vgiQqk5YenteU=; b=ZfDEYM1gq/EfWQ1/jTJn8UIMBGO1bgOCbOhZrBJC0Vjk6W2CVIppNxCigwGNKA6RcuSHnfRYM6xAMQKlQdmtvv0c7/kY5LSBJmtJhPZ62sjJVlcNVNtXz88CvftP/ibZibJcyRarkYqHPHsfuRAMRzPm3AkIQvFqtZhAsuIVADQ= 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=ay29a033018047205;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.XOFQRPj_1714386953; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XOFQRPj_1714386953) by smtp.aliyun-inc.com; Mon, 29 Apr 2024 18:35:54 +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 v1 2/5] mips: Add update_mmu_tlb_range() Date: Mon, 29 Apr 2024 18:33:43 +0800 Message-Id: <20240429103346.59115-3-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240429103346.59115-1-libang.li@antgroup.com> References: <20240429103346.59115-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index e27a4c83c548..0891ad7d43b6 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -596,6 +596,8 @@ 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 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 Apr 29 10:33:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13646583 Received: from out0-219.mail.aliyun.com (out0-219.mail.aliyun.com [140.205.0.219]) (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 0D86547A7D; Mon, 29 Apr 2024 10:36:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.219 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386967; cv=none; b=NNKtPg/m4JN9sT9FnUpRaZCxgFyME+n24bvMKYH43WLrYV4aPVmY9sbrAJp59LzXJsRROee/3LQmIan58WMBPWdEPvBxWqM3rekHUWvQSKvYwUDDl+YCzSjmq5C3Y3+Rb1HBF2wMWiwI+ajvd64XPabpnH6w8QmOZumBBnBcRQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386967; c=relaxed/simple; bh=D94EpgcBOw7XpW8dFSl53wbliA2dVLQsK7sAMadrCb0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jplpwvi4gNDVSFBtLjSmNAmU4Y0emuYJl5Y5PW1Z9XAvRmp9Mxy0JPRmR0uD6UKk0t4baOgwsNH+5vu932bIPZKqW0mnw93stYrhG9EG4MVjhvVzzUJ8/2n3qt2Xj/7+dbJrT1/yrhpDnCL9G9ycPnfBB4DY9krWSKsAUd5Nj2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=IeCiIMT8; arc=none smtp.client-ip=140.205.0.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="IeCiIMT8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1714386957; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Wijyh1yP2Yf03/VPvTBn+/oZ8/jA626iTOgm2E3/T4s=; b=IeCiIMT8W9i9d0/fphz6ObG9gDnl+7uKkTwAW5dUT26y+WdiMrMzNl5M+rRnkocnA+QF6ly15ttmGS5Ls3IfQ93qDgjG+8V29yfhIaHQj0YuTVlnGM+9V6XPAmTqHo6tMOiw2dOmgUc5DoRpsPCJDIwf6pRapDa/zGctfgUJbKc= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047193;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.XOFQRQ6_1714386955; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XOFQRQ6_1714386955) by smtp.aliyun-inc.com; Mon, 29 Apr 2024 18:35:55 +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 v1 3/5] riscv: Add update_mmu_tlb_range() Date: Mon, 29 Apr 2024 18:33:44 +0800 Message-Id: <20240429103346.59115-4-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240429103346.59115-1-libang.li@antgroup.com> References: <20240429103346.59115-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Added update_mmu_tlb_range function, we can batch update tlb of an address range. Signed-off-by: Bang Li --- arch/riscv/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index f2d5973a011b..d515a11a52cd 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -488,6 +488,8 @@ 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 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 Apr 29 10:33:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13646585 Received: from out187-3.us.a.mail.aliyun.com (out187-3.us.a.mail.aliyun.com [47.90.187.3]) (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 642D24F891; Mon, 29 Apr 2024 10:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386973; cv=none; b=iscVzIfGEPWfGiyukyvddWXThPUSAqKWDVQt+3PlYCH7mCnYf5bpyJT6is5xbxFf3Pj4OpLNUEqv1JLekEwuzMqb8YSXBE4Tc7qaP42KfxD0KlO6mjFXp6oMJqs/Jm/UmIfCTER1YX2GlDPWgu4L3HI41c24O/baGSSUp5M7P9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386973; c=relaxed/simple; bh=PPzTdu8GHUSCZuJDiTQr/ewx5LKlmshWf3qQHg5D1RQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XASQPAqLFZvFwW7ExWpA2UyqoZ++x4JBEITjxjqwrqzGvtLrOx8fRfICEftDaG+QrpaeG5MsqmmaaPbscU1Vjf0nOzQzE4SyUNfQjDA8kDnrW0EnZnuNh9r1fE56E518Vj0yNna/c56NTgQLITudg5FcBOA3BBCF7zsyqAeLnvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=rLohAmKf; arc=none smtp.client-ip=47.90.187.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="rLohAmKf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1714386959; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=L9Nnq3jHrztC2V1l+aPsgS97TA5W6U5sPTcwdSCKib4=; b=rLohAmKf4SrixuQnHlrxT++B6o0m4L2zDIthfDKSFqfKyzTipMDIIOixCW9vJBJ4L2/Y/QHPBgjl2mdPKNGZIcgwZ1bJBeSy3P6Pk38aZPA3ZFObZxMExxIx3bwaR7sX/aZi7y4QRpNEthyaXmLYoUwKnlf9phi0ZR40Wgcs+AQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R831e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047207;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.XOEanMa_1714386956; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XOEanMa_1714386956) by smtp.aliyun-inc.com; Mon, 29 Apr 2024 18:35:57 +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 v1 4/5] xtensa: Add update_mmu_tlb_range() Date: Mon, 29 Apr 2024 18:33:45 +0800 Message-Id: <20240429103346.59115-5-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240429103346.59115-1-libang.li@antgroup.com> References: <20240429103346.59115-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 2 ++ arch/xtensa/mm/tlb.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index 9a7e5e57ee9a..50ccfc988256 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h @@ -412,6 +412,8 @@ typedef pte_t *pte_addr_t; void update_mmu_tlb(struct vm_area_struct *vma, unsigned long address, pte_t *ptep); +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 #endif /* !defined (__ASSEMBLY__) */ 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 Apr 29 10:33:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bang Li X-Patchwork-Id: 13646584 Received: from out0-210.mail.aliyun.com (out0-210.mail.aliyun.com [140.205.0.210]) (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 B83554E1BE; Mon, 29 Apr 2024 10:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.210 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386971; cv=none; b=OY/AeFbaM4mUC1XqttBjvRkZi46D/xLwuuPFgtRtbnY3z4802xH7vn1SYaoveW9Ioq4NnpaG8Fhs9jsMu7sC5sphql6xPBqbVCQHxPWRXZwJiR/FByG+7AR8/ZI0zuu60juUkxRbyZ6H7iB8cZNFwXAatBiTQ2dcsc9xVknnt1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714386971; c=relaxed/simple; bh=VY9sZlLbdOohRHek7Or+cOx51HaBJ+7tOVXra2qD9VE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ar68NBxp9A97f/Q6H772Xi5qj+yroP8ZAi+fx3I4Ha+bWHY2yrTJfnAU2BaBlnwOq1iPcbD5aQS+cBezoEY/TlHVCczJ3PQP3XSsmTioNowX8+r4fbS7o+unG6LfgTmcGDzIaFBdTZRZZ9+pDNipouGAKpdBoAcl03uDW/ZsnQA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=V9juz5Rx; arc=none smtp.client-ip=140.205.0.210 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="V9juz5Rx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1714386961; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=MCByWayo1rTtWGbtdA4qwJOFgDYVs7q3tTYHIInGmHY=; b=V9juz5RxFGMGwrjlGxUh97IayTySsqHdx93GAsZJba2WhiS8GGBz02xt4XsuxTdbaQ9wKXc7rUzfor1j2xII6VQP6ynLRcRZTlCtX/ozvt3PeNKrm2W2FTXR2a1q32wbdkxfpqivwBtjHj2UacqHIdl2SS6tZ0M5i4ybLeSuRJI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;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=17;SR=0;TI=SMTPD_---.XOEanMm_1714386958; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XOEanMm_1714386958) by smtp.aliyun-inc.com; Mon, 29 Apr 2024 18:35:59 +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 v1 5/5] mm: Add update_mmu_tlb_range() Date: Mon, 29 Apr 2024 18:33:46 +0800 Message-Id: <20240429103346.59115-6-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240429103346.59115-1-libang.li@antgroup.com> References: <20240429103346.59115-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 5 +++++ mm/memory.c | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 18019f037bae..73411dfebf7a 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -734,6 +734,11 @@ static inline void update_mmu_tlb(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) { } + +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 #endif diff --git a/mm/memory.c b/mm/memory.c index 6647685fd3c4..1f0ca362b82a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4396,7 +4396,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) @@ -4465,8 +4464,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; }