On Fri, Nov 6, 2026 at 7:53 PM Lorenzo Stoakes (ARM) <[email protected]> wrote:
[...]
> > --
> > Sashiko AI review · 
> > https://sashiko.dev/#/patchset/[email protected]?part=2
>
> It seems these are valid, oops!
>
> Andrew suggested a fix off-list, and I agreed to this as an in-place fixup to
> avoid respin.
>
> I have also updated the series locally to reflect this change:

Seems like a reasonable fix. maybe_unlock_mmap_for_io()
could have released mmap_lock, leaving the VMA
unprotected. but  ra->size *= 2 is still going there no matter
if the vma has disappeared

For the original patch combined with the fix,

Reviewed-by: Barry Song <[email protected]>

>
> ----8<----
>  mm/filemap.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- 
> a/mm/filemap.c~mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t-fix
> +++ a/mm/filemap.c
> @@ -3410,6 +3410,7 @@ static struct file *do_sync_mmap_readahe
>
>         if (force_thp_readahead) {
>                 unsigned long folio_nr_pages = 1UL << thp_order;
> +               const bool random_read = vma_test(vma, VMA_RAND_READ_BIT);
>
>                 fpin = maybe_unlock_mmap_for_io(vmf, fpin);
>                 ractl._index &= ~(folio_nr_pages - 1);
> @@ -3418,7 +3419,7 @@ static struct file *do_sync_mmap_readahe
>                  * Fetch two folios so we get the chance to actually
>                  * readahead, unless we've been told not to.
>                  */
> -               if (!vma_test(vma, VMA_RAND_READ_BIT))
> +               if (!random_read)
>                         ra->size *= 2;
>                 ra->async_size = folio_nr_pages;
>                 ra->order = thp_order;
> @@ -3438,7 +3439,6 @@ static struct file *do_sync_mmap_readahe
>                  * pad that might exist between sections, which would be a 
> waste
>                  * of memory.
>                  */
> -               struct vm_area_struct *vma = vmf->vma;
>                 const unsigned long start = vma_start_pgoff(vma);
>                 const unsigned long end = vma_end_pgoff(vma);
>                 unsigned long ra_end;
> _
>

Thanks,
Barry

Reply via email to