linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Suren Baghdasaryan <surenb@google.com>,
	Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH 1/4] mm: Assert the mmap_lock is held in __anon_vma_prepare()
Date: Fri, 26 Apr 2024 19:34:50 +0200	[thread overview]
Message-ID: <a9fd2bc7-a9b4-4e60-b178-f60aa5c2a6de@redhat.com> (raw)
In-Reply-To: <20240426144506.1290619-2-willy@infradead.org>

On 26.04.24 16:45, Matthew Wilcox (Oracle) wrote:
> Convert the comment into an assertion.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   mm/rmap.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 2608c40dffad..619d4d65d99b 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -182,8 +182,6 @@ static void anon_vma_chain_link(struct vm_area_struct *vma,
>    * for the new allocation. At the same time, we do not want
>    * to do any locking for the common case of already having
>    * an anon_vma.
> - *
> - * This must be called with the mmap_lock held for reading.
>    */
>   int __anon_vma_prepare(struct vm_area_struct *vma)
>   {
> @@ -191,6 +189,7 @@ int __anon_vma_prepare(struct vm_area_struct *vma)
>   	struct anon_vma *anon_vma, *allocated;
>   	struct anon_vma_chain *avc;
>   
> +	mmap_assert_locked(mm);
>   	might_sleep();
>   
>   	avc = anon_vma_chain_alloc(GFP_KERNEL);

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



  parent reply	other threads:[~2024-04-26 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 14:44 [PATCH 0/4] Improve anon_vma scalability for anon VMAs Matthew Wilcox (Oracle)
2024-04-26 14:45 ` [PATCH 1/4] mm: Assert the mmap_lock is held in __anon_vma_prepare() Matthew Wilcox (Oracle)
2024-04-26 15:23   ` Suren Baghdasaryan
2024-04-26 17:34   ` David Hildenbrand [this message]
2024-04-26 14:45 ` [PATCH 2/4] mm: Delay the check for a NULL anon_vma Matthew Wilcox (Oracle)
2024-04-26 14:45 ` [PATCH 3/4] mm: Fix some minor per-VMA lock issues in userfaultfd Matthew Wilcox (Oracle)
2024-04-26 15:23   ` Suren Baghdasaryan
2024-04-26 14:45 ` [PATCH 4/4] mm: Optimise vmf_anon_prepare() for VMAs without an anon_vma Matthew Wilcox (Oracle)
2024-04-26 17:36   ` David Hildenbrand

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=a9fd2bc7-a9b4-4e60-b178-f60aa5c2a6de@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=peterx@redhat.com \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).