From: Qi Zheng <zhengqi.arch@bytedance.com>
To: Yajun Deng <yajun.deng@linux.dev>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/rmap: remove unnecessary page_table_lock
Date: Mon, 22 Apr 2024 19:24:58 +0800 [thread overview]
Message-ID: <abe2a739-d50c-42b4-8701-ae89435da23e@bytedance.com> (raw)
In-Reply-To: <20240422105212.1485788-1-yajun.deng@linux.dev>
On 2024/4/22 18:52, Yajun Deng wrote:
> 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().
IIUC, the page_table_lock here is not to protect page table, but as
mentioned in the comments, to prevent concurrent modification by
multiple threads.
>
> Signed-off-by: Yajun Deng <yajun.deng@linux.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))
next prev parent reply other threads:[~2024-04-22 11:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 10:52 Yajun Deng
2024-04-22 11:24 ` Qi Zheng [this message]
[not found] ` <b848c431-deca-42e4-925c-673b3fa1f251@redhat.com>
2024-04-23 7:53 ` Yajun Deng
2024-04-23 8:18 ` David Hildenbrand
2024-04-23 8:35 ` Yajun Deng
2024-04-23 17:11 ` Liam R. Howlett
2024-04-24 3:04 ` Yajun Deng
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=abe2a739-d50c-42b4-8701-ae89435da23e@bytedance.com \
--to=zhengqi.arch@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=yajun.deng@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox