linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Matthew Wilcox <willy@infradead.org>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,
	syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.com,
	Suren Baghdasaryan <surenb@google.com>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>
Subject: Re: [PATCH v2] mm: fix vma_start_write_killable() signal handling
Date: Thu, 27 Nov 2025 10:05:38 +0100	[thread overview]
Message-ID: <c8f79c5c-7354-4f6b-b9cb-3eb43381d03a@suse.cz> (raw)
In-Reply-To: <aSd6oH29iELxxU5o@casper.infradead.org>

On 11/26/25 23:09, Matthew Wilcox wrote:
> On Wed, Nov 26, 2025 at 08:33:47PM +0000, Lorenzo Stoakes wrote:
>> 	if (refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt)) {
>> 		/*
>> 		 * If the VMA is now detached which means we lost a race.
>> 		 * Let the caller know the VMA is detached.
>> 		 */
>> 		err = 0;
>> 	}
>> 
>> That gives a _lot_ more information, keeps it relatively top-level, doesn't
>> make undue assumptions etc.
> 
> Here's what I now have:
> 
>         if (err) {
>                 if (refcount_sub_and_test(VMA_LOCK_OFFSET, &vma->vm_refcnt)) {
>                         /*
>                          * The wait failed, but the last reader went away
>                          * as well.  Tell the caller the VMA is detached.
>                          */
>                         WARN_ON_ONCE(!detaching);
>                         err = 0;
>                 }

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Thanks.

> 
>> > Are you satisfied with the WARN_ON(!detaching)?
>> >
>> 
>> It'd be super weird to reach that code when not detaching so sure, think it
>> should be VM_WARN_ON() though since the code would be horribly broken if
>> that was not the case already no?
> 
> The other places in this file are WARN_ON_ONCE rather than VM_WARN*, so
> keep it consistent.



      parent reply	other threads:[~2025-11-27  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 17:44 Matthew Wilcox (Oracle)
2025-11-26 18:06 ` Lorenzo Stoakes
2025-11-26 18:28   ` Matthew Wilcox
2025-11-26 18:43     ` Suren Baghdasaryan
2025-11-26 18:53       ` Vlastimil Babka
2025-11-26 19:34         ` Matthew Wilcox
2025-11-26 19:00       ` Lorenzo Stoakes
2025-11-26 18:55     ` Lorenzo Stoakes
2025-11-26 19:44       ` Matthew Wilcox
2025-11-26 20:33         ` Lorenzo Stoakes
2025-11-26 20:35           ` Lorenzo Stoakes
2025-11-26 22:09           ` Matthew Wilcox
2025-11-27  6:26             ` Lorenzo Stoakes
2025-11-27  9:05             ` Vlastimil Babka [this message]

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=c8f79c5c-7354-4f6b-b9cb-3eb43381d03a@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=surenb@google.com \
    --cc=syzbot+5b19bad23ac7f44bf8b8@syzkaller.appspotmail.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