From: Qu Wenruo <wqu@suse.com>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
Qu Wenruo <quwenruo.btrfs@gmx.com>,
Linux Memory Management List <linux-mm@kvack.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
vivek.kasireddy@intel.com,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: Large folios and filemap_get_folios_contig()
Date: Fri, 4 Apr 2025 14:45:32 +1030 [thread overview]
Message-ID: <c4d317ed-859c-4ee0-bdbe-e92f4cd7fb95@suse.com> (raw)
In-Reply-To: <Z-8s1-kiIDkzgRbc@fedora>
在 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
prev parent reply other threads:[~2025-04-04 4:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 9:36 Qu Wenruo
2025-04-03 12:35 ` Matthew Wilcox
2025-04-03 21:16 ` Qu Wenruo
2025-04-04 0:50 ` Vishal Moola (Oracle)
2025-04-04 4:15 ` Qu Wenruo [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=c4d317ed-859c-4ee0-bdbe-e92f4cd7fb95@suse.com \
--to=wqu@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=vishal.moola@gmail.com \
--cc=vivek.kasireddy@intel.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