From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: David Hildenbrand <david@redhat.com>
Cc: Lance Yang <ioworker0@gmail.com>,
akpm@linux-foundation.org, 21cnbao@gmail.com,
Liam.Howlett@oracle.com, vbabka@suse.cz, jannh@google.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Lance Yang <lance.yang@linux.dev>
Subject: Re: [PATCH 1/1] mm/madvise: initialize prev pointer in madvise_walk_vmas
Date: Tue, 17 Jun 2025 09:50:51 +0100 [thread overview]
Message-ID: <8aa7932b-e30d-4025-8503-726e01bd7539@lucifer.local> (raw)
In-Reply-To: <e174d4ae-9467-4fd7-906a-d575802aaecf@redhat.com>
On Tue, Jun 17, 2025 at 10:38:07AM +0200, David Hildenbrand wrote:
> > > > > vma = vma_modify_flags_name(&vmi, *prev, ...
> > > > >
> > > > > We should use Fixes: then.
> > > >
> > > > So no we shouldn't...
> > > >
> > > > >
> > > > >
> > > > > Acked-by: David Hildenbrand <david@redhat.com>
> > > >
> > > > Sure? :)
> > >
> > > Unless I am missing something important, yes :)
> >
> > This solution isn't correct as prev == NULL when prev != NULL is wholly
> > incorrect.
>
> I am not able to understand what you mean :)
>
> I assume you mean, that we reach a point down in the callchain, where "prev"
> is supposed to be set to something proper, but it would be "NULL".
I mean if you tell merge code 'hey the previous VMA is NULL' (same thing as
saying 'hey this is the first VMA in the address space) and it isn't, bad things
will happen (TM).
>
> That would indeed require a different fix.
Yes this patch is wrong, sorry.
>
> I wonder why we didn't trigger this case so far?
It's because it only happens since Barry's per-VMA lock logic...
if (madv_behavior && madv_behavior->lock_mode == MADVISE_VMA_READ_LOCK) {
vma = try_vma_read_lock(mm, madv_behavior, start, end);
if (vma) {
error = visit(vma, &prev, start, end, arg);
vma_end_read(vma);
return error;
}
}
Otherwise, we look up the find_vma_prev():
vma = find_vma_prev(mm, start, &prev);
In madvise_dontneed_free() we always set *prev = vma _first_.
Let me suggest the better fix to Lance higher in thread so he sees :)
Not sure if a fixes is valid here given this isn't mainline yet, more so this
should be squashed with barry's series?
>
> --
> Cheers,
>
> David / dhildenb
>
>
next prev parent reply other threads:[~2025-06-17 8:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 2:05 Lance Yang
2025-06-17 2:24 ` Barry Song
2025-06-17 4:57 ` Lance Yang
2025-06-17 5:19 ` Barry Song
2025-06-17 6:03 ` Lance Yang
2025-06-17 7:54 ` David Hildenbrand
2025-06-17 8:18 ` Lance Yang
2025-06-17 8:21 ` Lorenzo Stoakes
2025-06-17 8:28 ` David Hildenbrand
2025-06-17 8:34 ` Lorenzo Stoakes
2025-06-17 8:38 ` David Hildenbrand
2025-06-17 8:50 ` Lorenzo Stoakes [this message]
2025-06-17 8:53 ` David Hildenbrand
2025-06-17 8:43 ` Lorenzo Stoakes
2025-06-17 8:51 ` Lorenzo Stoakes
2025-06-17 8:26 ` Lorenzo Stoakes
2025-06-17 8:50 ` Lorenzo Stoakes
2025-06-17 9:21 ` Lance Yang
2025-06-17 9:26 ` Lorenzo Stoakes
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=8aa7932b-e30d-4025-8503-726e01bd7539@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=21cnbao@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=ioworker0@gmail.com \
--cc=jannh@google.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/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