All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qi Zheng <zhengqi.arch@bytedance.com>
To: akpm@linux-foundation.org, maobibo@loongson.cn,
	chenhuacai@loongson.cn, songmuchun@bytedance.com,
	david@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	loongarch@lists.linux.dev, chris@zankel.net, jcmvbkbc@gmail.com,
	Qi Zheng <zhengqi.arch@bytedance.com>
Subject: [PATCH v3 2/2] LoongArch: update local TLB if PTE entry exists
Date: Thu, 29 Sep 2022 19:23:18 +0800	[thread overview]
Message-ID: <20220929112318.32393-3-zhengqi.arch@bytedance.com> (raw)
In-Reply-To: <20220929112318.32393-1-zhengqi.arch@bytedance.com>

Currently, the implementation of update_mmu_tlb() is empty if
__HAVE_ARCH_UPDATE_MMU_TLB is not defined. Then if two threads
concurrently fault at the same page, the second thread that did
not win the race will give up and do nothing. In the LoongArch
architecture, this second thread will trigger another fault,
and only updates its local TLB.

Instead of triggering another fault, it's better to implement
update_mmu_tlb() to directly update the local TLB of the second
thread. Just do it.

Suggested-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
 arch/loongarch/include/asm/pgtable.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
index 8ea57e2f0e04..946704bee599 100644
--- a/arch/loongarch/include/asm/pgtable.h
+++ b/arch/loongarch/include/asm/pgtable.h
@@ -412,6 +412,9 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
 	__update_tlb(vma, address, ptep);
 }
 
+#define __HAVE_ARCH_UPDATE_MMU_TLB
+#define update_mmu_tlb	update_mmu_cache
+
 static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
 			unsigned long address, pmd_t *pmdp)
 {
-- 
2.20.1


  parent reply	other threads:[~2022-09-29 11:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-29 11:23 [PATCH v3 0/2] use update_mmu_tlb() on the second thread Qi Zheng
2022-09-29 11:23 ` [PATCH v3 1/2] mm: " Qi Zheng
2022-09-30  8:30   ` David Hildenbrand
2022-09-30  8:43     ` Qi Zheng
2022-09-30  8:44       ` David Hildenbrand
2022-09-30  8:46         ` Qi Zheng
2022-09-30 22:31         ` Andrew Morton
2022-09-30 23:09           ` Qi Zheng
2022-09-29 11:23 ` Qi Zheng [this message]
2022-09-29 11:42   ` [PATCH v3 2/2] LoongArch: update local TLB if PTE entry exists Huacai Chen
2022-09-29 12:10     ` Qi Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929112318.32393-3-zhengqi.arch@bytedance.com \
    --to=zhengqi.arch@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenhuacai@loongson.cn \
    --cc=chris@zankel.net \
    --cc=david@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    --cc=songmuchun@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.