[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpEf06MfXBORqbCyOi20omJziz+ySBiDxsAzcUSY_OaoKQ@mail.gmail.com>
Date: Tue, 7 Jan 2025 09:31:25 -0800
From: Suren Baghdasaryan <surenb@...gle.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: akpm@...ux-foundation.org, peterz@...radead.org, willy@...radead.org,
liam.howlett@...cle.com, lorenzo.stoakes@...cle.com, mhocko@...e.com,
hannes@...xchg.org, mjguzik@...il.com, oliver.sang@...el.com,
mgorman@...hsingularity.net, david@...hat.com, peterx@...hat.com,
oleg@...hat.com, dave@...olabs.net, paulmck@...nel.org, brauner@...nel.org,
dhowells@...hat.com, hdanton@...a.com, hughd@...gle.com,
lokeshgidra@...gle.com, minchan@...gle.com, jannh@...gle.com,
shakeel.butt@...ux.dev, souravpanda@...gle.com, pasha.tatashin@...een.com,
klarasmodin@...il.com, corbet@....net, linux-doc@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v7 08/17] mm: allow vma_start_read_locked/vma_start_read_locked_nested
to fail
On Tue, Jan 7, 2025 at 9:28 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 12/26/24 18:07, Suren Baghdasaryan wrote:
> > With upcoming replacement of vm_lock with vm_refcnt, we need to handle a
> > possibility of vma_start_read_locked/vma_start_read_locked_nested failing
> > due to refcount overflow. Prepare for such possibility by changing these
> > APIs and adjusting their users.
> >
> > Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> > Cc: Lokesh Gidra <lokeshgidra@...gle.com>
>
> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>
> (I don't know if this can break some uffd users?)
I checked with Lokesh who added that uffd code and he confirmed that
uffd will handle errors correctly.
>
> > @@ -1483,10 +1484,16 @@ static int uffd_move_lock(struct mm_struct *mm,
> > mmap_read_lock(mm);
> > err = find_vmas_mm_locked(mm, dst_start, src_start, dst_vmap, src_vmap);
> > if (!err) {
> > - vma_start_read_locked(*dst_vmap);
> > - if (*dst_vmap != *src_vmap)
> > - vma_start_read_locked_nested(*src_vmap,
> > - SINGLE_DEPTH_NESTING);
> > + if (vma_start_read_locked(*dst_vmap)) {
> > + if (*dst_vmap != *src_vmap) {
> > + if (!vma_start_read_locked_nested(*src_vmap,
> > + SINGLE_DEPTH_NESTING)) {
> > + vma_end_read(*dst_vmap);
> > + err = -EAGAIN;
> > + }
> > + }
> > + } else
> > + err = -EAGAIN;
>
> Nit: { } per style
Ack.
>
> > }
> > mmap_read_unlock(mm);
> > return err;
>
Powered by blists - more mailing lists