From patchwork Wed Jun 24 09:26:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bibo mao X-Patchwork-Id: 11622717 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B1536C1 for ; Wed, 24 Jun 2020 09:26:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 024BA20874 for ; Wed, 24 Jun 2020 09:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 024BA20874 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 591926B0005; Wed, 24 Jun 2020 05:26:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 540F86B0007; Wed, 24 Jun 2020 05:26:43 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3306B000A; Wed, 24 Jun 2020 05:26:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 270E96B0005 for ; Wed, 24 Jun 2020 05:26:43 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D4296B9FC for ; Wed, 24 Jun 2020 09:26:42 +0000 (UTC) X-FDA: 76963575444.02.mist94_0b0205726e43 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 9F18F100098138E9 for ; Wed, 24 Jun 2020 09:26:42 +0000 (UTC) X-Spam-Summary: 1,0,0,aa6cd35c0a7d3adf,d41d8cd98f00b204,maobibo@loongson.cn,,RULES_HIT:41:355:379:541:800:960:988:989:1042:1260:1261:1345:1437:1535:1543:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:2693:2895:3138:3139:3140:3141:3142:3355:3865:3866:3867:3871:3872:3874:4250:4321:4605:5007:6119:6261:7903:8603:10004:11026:11473:11657:11658:11914:12043:12048:12114:12160:12296:12297:12438:12555:12895:12986:14096:14181:14394:14721:21080:21451:21627:21772:21990:30003:30054:30070:30090,0,RBL:114.242.206.163:@loongson.cn:.lbl8.mailshell.net-62.14.2.100 64.201.201.201;04yg8b43pqs9d5ret4n8q5j85ph4qopyozrhj6jguj1w99yd5s34bfkct33u8zz.g5ujh5bdzshm5g1h9ht7z7zppg4dcf5ox49euxq1cik717rb5f9jjwqhqmpdryc.e-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: mist94_0b0205726e43 X-Filterd-Recvd-Size: 5552 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 09:26:40 +0000 (UTC) Received: from kvm-dev1.localdomain (unknown [10.2.5.134]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxNupIHPNe6zFJAA--.493S2; Wed, 24 Jun 2020 17:26:32 +0800 (CST) From: Bibo Mao To: Andrew Morton , Thomas Bogendoerfer , Paul Burton , Anshuman Khandual , Mike Rapoport , Daniel Silsby Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/3] mm: set page fault address for update_mmu_cache_pmd Date: Wed, 24 Jun 2020 17:26:30 +0800 Message-Id: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: AQAAf9AxNupIHPNe6zFJAA--.493S2 X-Coremail-Antispam: 1UD129KBjvJXoWxZF1fAry7ArW7CrW7XrW3GFg_yoW5uFWDpF 97Can5XFsIqw1kuayfXr4qkr15J3s2qay7Kry2k3ZYv3Waqr1S9w1DAwn5Ar98Jry8ua13 CF4YgFZ8Xw4fZaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkYb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4 vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv F2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r 4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE-syl42xK82IY c2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0x vE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2 jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU56c_DUUUUU== X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Rspamd-Queue-Id: 9F18F100098138E9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: update_mmu_cache_pmd is used to update tlb for the pmd entry by software. On MIPS system, the tlb entry indexed by page fault address maybe exists already, only that tlb entry may be small page, also it may be huge page. Before updating pmd entry with huge page size, older tlb entry need to be invalidated. Here page fault address is passed to function update_mmu_cache_pmd, rather than pmd huge page start address. The page fault address can be used for invalidating older tlb entry. Signed-off-by: Bibo Mao --- arch/mips/include/asm/pgtable.h | 9 +++++++++ mm/huge_memory.c | 7 ++++--- mm/memory.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index dd7a0f5..bd81661 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h @@ -554,11 +554,20 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, #define __HAVE_ARCH_UPDATE_MMU_TLB #define update_mmu_tlb update_mmu_cache +extern void local_flush_tlb_page(struct vm_area_struct *vma, + unsigned long page); static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) { pte_t pte = *(pte_t *)pmdp; + /* + * If pmd_none is true, older tlb entry will be normal page. + * here to invalidate older tlb entry indexed by address + * parameter address must be page fault address rather than + * start address of pmd huge page + */ + local_flush_tlb_page(vma, address); __update_tlb(vma, address, pte); } diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 78c84be..0f9187b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -780,6 +780,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, pgtable_t pgtable) { struct mm_struct *mm = vma->vm_mm; + unsigned long start = addr & PMD_MASK; pmd_t entry; spinlock_t *ptl; @@ -792,7 +793,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, } entry = pmd_mkyoung(*pmd); entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); - if (pmdp_set_access_flags(vma, addr, pmd, entry, 1)) + if (pmdp_set_access_flags(vma, start, pmd, entry, 1)) update_mmu_cache_pmd(vma, addr, pmd); } @@ -813,7 +814,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, pgtable = NULL; } - set_pmd_at(mm, addr, pmd, entry); + set_pmd_at(mm, start, pmd, entry); update_mmu_cache_pmd(vma, addr, pmd); out_unlock: @@ -864,7 +865,7 @@ vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn, track_pfn_insert(vma, &pgprot, pfn); - insert_pfn_pmd(vma, addr, vmf->pmd, pfn, pgprot, write, pgtable); + insert_pfn_pmd(vma, vmf->address, vmf->pmd, pfn, pgprot, write, pgtable); return VM_FAULT_NOPAGE; } EXPORT_SYMBOL_GPL(vmf_insert_pfn_pmd_prot); diff --git a/mm/memory.c b/mm/memory.c index dc7f354..c703458 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3592,7 +3592,7 @@ static vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) set_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry); - update_mmu_cache_pmd(vma, haddr, vmf->pmd); + update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); /* fault is handled */ ret = 0; From patchwork Wed Jun 24 09:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bibo mao X-Patchwork-Id: 11622715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1216B138C for ; Wed, 24 Jun 2020 09:26:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D3DEF2088E for ; Wed, 24 Jun 2020 09:26:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3DEF2088E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DCF8D6B0002; Wed, 24 Jun 2020 05:26:42 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D7F246B0005; Wed, 24 Jun 2020 05:26:42 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C97F26B0007; Wed, 24 Jun 2020 05:26:42 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0025.hostedemail.com [216.40.44.25]) by kanga.kvack.org (Postfix) with ESMTP id AED106B0002 for ; Wed, 24 Jun 2020 05:26:42 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 603D1BBF4 for ; Wed, 24 Jun 2020 09:26:42 +0000 (UTC) X-FDA: 76963575444.17.door49_280824926e43 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 3FC7D180D0180 for ; Wed, 24 Jun 2020 09:26:42 +0000 (UTC) X-Spam-Summary: 1,0,0,13dc932533e4a814,d41d8cd98f00b204,maobibo@loongson.cn,,RULES_HIT:41:355:379:541:800:960:988:989:1042:1260:1261:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3868:3870:3871:4250:4321:5007:6119:6120:6261:7901:7903:10004:11026:11473:11658:11914:12043:12048:12160:12296:12297:12438:12555:12895:13069:13311:13357:14096:14181:14384:14394:14721:21080:21627:21772:30003:30054:30070,0,RBL:114.242.206.163:@loongson.cn:.lbl8.mailshell.net-64.201.201.201 62.14.2.100;04y8s6nf47rruny4syx6f4h65zxyhypgon79x76mh6opokoukb4dqi54okxns5q.nbjz6ae6b6ei947kwsbwhf3r7n1quizyuofhq4pa7y6io4wogcqy9c1gir5ex5i.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: door49_280824926e43 X-Filterd-Recvd-Size: 3657 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 09:26:40 +0000 (UTC) Received: from kvm-dev1.localdomain (unknown [10.2.5.134]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxNupIHPNe6zFJAA--.493S3; Wed, 24 Jun 2020 17:26:33 +0800 (CST) From: Bibo Mao To: Andrew Morton , Thomas Bogendoerfer , Paul Burton , Anshuman Khandual , Mike Rapoport , Daniel Silsby Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/3] mm/huge_memory.c: update tlb entry if pmd is changed Date: Wed, 24 Jun 2020 17:26:31 +0800 Message-Id: <1592990792-1923-2-git-send-email-maobibo@loongson.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> References: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> X-CM-TRANSID: AQAAf9AxNup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BIdaVFxhVjvjDU0xZFpf9x07bOg4hUUUUU= X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Rspamd-Queue-Id: 3FC7D180D0180 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000346, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When set_pmd_at is called in function do_huge_pmd_anonymous_page, new tlb entry can be added by software on MIPS platform. Here add update_mmu_cache_pmd when pmd entry is set, and update_mmu_cache_pmd is defined as empty excepts arc/mips platform. This patch has no negative effect on other platforms except arc/mips system. Signed-off-by: Bibo Mao --- mm/huge_memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0f9187b..8b4ccf7 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -643,6 +643,7 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, lru_cache_add_active_or_unevictable(page, vma); pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable); set_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry); + update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); add_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR); mm_inc_nr_ptes(vma->vm_mm); spin_unlock(vmf->ptl); @@ -756,6 +757,7 @@ vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf) } else { set_huge_zero_page(pgtable, vma->vm_mm, vma, haddr, vmf->pmd, zero_page); + update_mmu_cache_pmd(vma, vmf->address, vmf->pmd); spin_unlock(vmf->ptl); set = true; } From patchwork Wed Jun 24 09:26:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bibo mao X-Patchwork-Id: 11622719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B21876C1 for ; Wed, 24 Jun 2020 09:26:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 89B9F20857 for ; Wed, 24 Jun 2020 09:26:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89B9F20857 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 03ACE6B0007; Wed, 24 Jun 2020 05:26:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 012EF6B000C; Wed, 24 Jun 2020 05:26:44 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB03B6B0007; Wed, 24 Jun 2020 05:26:44 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id C3BDA6B0007 for ; Wed, 24 Jun 2020 05:26:44 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 87387BA12 for ; Wed, 24 Jun 2020 09:26:44 +0000 (UTC) X-FDA: 76963575528.26.oven66_37168c126e43 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 652F81804B668 for ; Wed, 24 Jun 2020 09:26:44 +0000 (UTC) X-Spam-Summary: 1,0,0,5539625824a5614d,d41d8cd98f00b204,maobibo@loongson.cn,,RULES_HIT:41:355:379:541:800:960:988:989:1260:1261:1345:1359:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:3872:4321:5007:6117:6119:6120:6261:7901:7903:8660:10004:11026:11658:11914:12043:12048:12160:12296:12297:12438:12555:12895:12986:13069:13148:13230:13311:13357:14096:14181:14384:14394:14721:21080:21212:21627:21939:30054,0,RBL:114.242.206.163:@loongson.cn:.lbl8.mailshell.net-64.100.201.201 62.2.2.100;04yfnxk1kg9bstfzp49iygyyu8f1roct81x9tiu85rxaghms4b53xw4sdgxwms8.aewj1pe3bqas9xrmwdy1x9d3k37fjr5sdgfi59jzqeutcedanezuhx9dzaki9a6.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: oven66_37168c126e43 X-Filterd-Recvd-Size: 3780 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 24 Jun 2020 09:26:41 +0000 (UTC) Received: from kvm-dev1.localdomain (unknown [10.2.5.134]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxNupIHPNe6zFJAA--.493S4; Wed, 24 Jun 2020 17:26:33 +0800 (CST) From: Bibo Mao To: Andrew Morton , Thomas Bogendoerfer , Paul Burton , Anshuman Khandual , Mike Rapoport , Daniel Silsby Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/3] MIPS: Do not call flush_tlb_all when setting pmd entry Date: Wed, 24 Jun 2020 17:26:32 +0800 Message-Id: <1592990792-1923-3-git-send-email-maobibo@loongson.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> References: <1592990792-1923-1-git-send-email-maobibo@loongson.cn> X-CM-TRANSID: AQAAf9AxN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daVFxhVjvjDU0xZFpf9x07jca9-UUUUU= X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Rspamd-Queue-Id: 652F81804B668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000017, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Function set_pmd_at is to set pmd entry, if tlb entry need to be flushed, there exists pmdp_huge_clear_flush alike function before set_pmd_at is called. So it is not necessary to call flush_tlb_all in this function. In these scenarios, tlb for the pmd range needs to be flushed: 1. privilege degrade such as wrprotect is set on the pmd entry 2. pmd entry is cleared 3. there is exception if set_pmd_at is issued by dup_mmap, since flush_tlb_mm is called for parent process, it is not necessary to flush tlb in function copy_huge_pmd. Signed-off-by: Bibo Mao --- arch/mips/mm/pgtable-32.c | 1 - arch/mips/mm/pgtable-64.c | 1 - 2 files changed, 2 deletions(-) diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c index bd4b065..61891af 100644 --- a/arch/mips/mm/pgtable-32.c +++ b/arch/mips/mm/pgtable-32.c @@ -45,7 +45,6 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; - flush_tlb_all(); } #endif /* defined(CONFIG_TRANSPARENT_HUGEPAGE) */ diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c index 183ff9f..7536f78 100644 --- a/arch/mips/mm/pgtable-64.c +++ b/arch/mips/mm/pgtable-64.c @@ -100,7 +100,6 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; - flush_tlb_all(); } void __init pagetable_init(void)