[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240422105212.1485788-1-yajun.deng@linux.dev>
Date: Mon, 22 Apr 2024 18:52:12 +0800
From: Yajun Deng <yajun.deng@...ux.dev>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Yajun Deng <yajun.deng@...ux.dev>
Subject: [PATCH] mm/rmap: remove unnecessary page_table_lock
page_table_lock is a lock that for page table, we won't change page
table in __anon_vma_prepare(). As we can see, it works well in
anon_vma_clone(). They do the same operation.
Remove unnecessary page_table_lock in __anon_vma_prepare().
Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
---
mm/rmap.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 2608c40dffad..e894640a9327 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -187,7 +187,6 @@ static void anon_vma_chain_link(struct vm_area_struct *vma,
*/
int __anon_vma_prepare(struct vm_area_struct *vma)
{
- struct mm_struct *mm = vma->vm_mm;
struct anon_vma *anon_vma, *allocated;
struct anon_vma_chain *avc;
@@ -208,8 +207,6 @@ int __anon_vma_prepare(struct vm_area_struct *vma)
}
anon_vma_lock_write(anon_vma);
- /* page_table_lock to protect against threads */
- spin_lock(&mm->page_table_lock);
if (likely(!vma->anon_vma)) {
vma->anon_vma = anon_vma;
anon_vma_chain_link(vma, avc, anon_vma);
@@ -217,7 +214,6 @@ int __anon_vma_prepare(struct vm_area_struct *vma)
allocated = NULL;
avc = NULL;
}
- spin_unlock(&mm->page_table_lock);
anon_vma_unlock_write(anon_vma);
if (unlikely(allocated))
--
2.25.1
Powered by blists - more mailing lists