Re: Large folios and filemap_get_folios_contig()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





在 2025/4/4 11:20, Vishal Moola (Oracle) 写道:
On Fri, Apr 04, 2025 at 07:46:59AM +1030, Qu Wenruo wrote:

[...]
Then I looked into the caller of filemap_get_folios_contig() inside
mm/gup, and it indeed does the correct skip.

... that code looks wrong to me.

It looks like it's xas_find() is doing the correct skip by calling
xas_next_offset() -> xas_move_index() to skip the next one.

But the filemap_get_folios_contig() only calls xas_next() by increasing the
index, not really skip to the next folio.

Although I can be totally wrong as I'm not familiar with the xarray
internals at all.

Thanks for bringing this to my attention, it looks like this is due to a
mistake during my folio conversion for this function. The xas_next()
call tries to go to the next index, but if that index is part of a
multi-index entry things get awkward if we don't manually account for the
index shift of a large folio (which I missed).

Can you please try out this attached patch and see if it gets rid of
the duplicate problem?

My reproducer no longer hang and the trace events indeed shows only one folio returned.

Thanks for the quick fix,
Qu


However I totally agree the duplicated behavior (and the extra handling of
duplicated entries) looks very wrong.

Thanks,
Qu





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux