Message ID | 20240625090646.1194644-1-gshan@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | mm/filemap: Limit page cache size to that supported by xarray | expand |
On Tue, 25 Jun 2024 19:06:42 +1000 Gavin Shan <gshan@redhat.com> wrote: > Currently, xarray can't support arbitrary page cache size. More details > can be found from the WARN_ON() statement in xas_split_alloc(). In our > test whose code is attached below, we hit the WARN_ON() on ARM64 system > where the base page size is 64KB and huge page size is 512MB. The issue > was reported long time ago and some discussions on it can be found here > [1]. > > [1] https://www.spinics.net/lists/linux-xfs/msg75404.html > > In order to fix the issue, we need to adjust MAX_PAGECACHE_ORDER to one > supported by xarray and avoid PMD-sized page cache if needed. The code > changes are suggested by David Hildenbrand. > > PATCH[1] adjusts MAX_PAGECACHE_ORDER to that supported by xarray > PATCH[2-3] avoids PMD-sized page cache in the synchronous readahead path > PATCH[4] avoids PMD-sized page cache for shmem files if needed Questions on the timing of these. 1&2 are cc:stable whereas 3&4 are not. I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A problem with this approach is that we're putting a basically untested combination into -stable: 1&2 might have bugs which were accidentally fixed in 3&4. A way to avoid this is to add cc:stable to all four patches. What are your thoughts on this matter?
On 25.06.24 20:37, Andrew Morton wrote: > On Tue, 25 Jun 2024 19:06:42 +1000 Gavin Shan <gshan@redhat.com> wrote: > >> Currently, xarray can't support arbitrary page cache size. More details >> can be found from the WARN_ON() statement in xas_split_alloc(). In our >> test whose code is attached below, we hit the WARN_ON() on ARM64 system >> where the base page size is 64KB and huge page size is 512MB. The issue >> was reported long time ago and some discussions on it can be found here >> [1]. >> >> [1] https://www.spinics.net/lists/linux-xfs/msg75404.html >> >> In order to fix the issue, we need to adjust MAX_PAGECACHE_ORDER to one >> supported by xarray and avoid PMD-sized page cache if needed. The code >> changes are suggested by David Hildenbrand. >> >> PATCH[1] adjusts MAX_PAGECACHE_ORDER to that supported by xarray >> PATCH[2-3] avoids PMD-sized page cache in the synchronous readahead path >> PATCH[4] avoids PMD-sized page cache for shmem files if needed > > Questions on the timing of these. > > 1&2 are cc:stable whereas 3&4 are not. > > I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A > problem with this approach is that we're putting a basically untested > combination into -stable: 1&2 might have bugs which were accidentally > fixed in 3&4. A way to avoid this is to add cc:stable to all four > patches. > > What are your thoughts on this matter? Especially 4 should also be CC stable, so likely we should just do it for all of them.
On Tue, 25 Jun 2024 20:51:13 +0200 David Hildenbrand <david@redhat.com> wrote: > > I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A > > problem with this approach is that we're putting a basically untested > > combination into -stable: 1&2 might have bugs which were accidentally > > fixed in 3&4. A way to avoid this is to add cc:stable to all four > > patches. > > > > What are your thoughts on this matter? > > Especially 4 should also be CC stable, so likely we should just do it > for all of them. Fine. A Fixes: for 3 & 4 would be good. Otherwise we're potentially asking for those to be backported further than 1 & 2, which seems wrong. Then again, by having different Fixes: in the various patches we're suggesting that people split the patch series apart as they slot things into the indicated places. In other words, it's not a patch series at all - it's a sprinkle of independent fixes. Are we OK thinking of it in that fashion?
On 25.06.24 20:58, Andrew Morton wrote: > On Tue, 25 Jun 2024 20:51:13 +0200 David Hildenbrand <david@redhat.com> wrote: > >>> I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A >>> problem with this approach is that we're putting a basically untested >>> combination into -stable: 1&2 might have bugs which were accidentally >>> fixed in 3&4. A way to avoid this is to add cc:stable to all four >>> patches. >>> >>> What are your thoughts on this matter? >> >> Especially 4 should also be CC stable, so likely we should just do it >> for all of them. > > Fine. A Fixes: for 3 & 4 would be good. Otherwise we're potentially > asking for those to be backported further than 1 & 2, which seems > wrong. 4 is shmem fix, which likely dates back a bit longer. > > Then again, by having different Fixes: in the various patches we're > suggesting that people split the patch series apart as they slot things > into the indicated places. In other words, it's not a patch series at > all - it's a sprinkle of independent fixes. Are we OK thinking of it > in that fashion? The common themes is "pagecache cannot handle > order-11", #1-3 tackle "ordinary" file THP, #4 tackles shmem THP. So I'm not sure we should be splitting it apart. It's just that shmem THP arrived before file THP :)
On 6/26/24 5:05 AM, David Hildenbrand wrote: > On 25.06.24 20:58, Andrew Morton wrote: >> On Tue, 25 Jun 2024 20:51:13 +0200 David Hildenbrand <david@redhat.com> wrote: >> >>>> I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A >>>> problem with this approach is that we're putting a basically untested >>>> combination into -stable: 1&2 might have bugs which were accidentally >>>> fixed in 3&4. A way to avoid this is to add cc:stable to all four >>>> patches. >>>> >>>> What are your thoughts on this matter? >>> >>> Especially 4 should also be CC stable, so likely we should just do it >>> for all of them. >> >> Fine. A Fixes: for 3 & 4 would be good. Otherwise we're potentially >> asking for those to be backported further than 1 & 2, which seems >> wrong. > > 4 is shmem fix, which likely dates back a bit longer. > >> >> Then again, by having different Fixes: in the various patches we're >> suggesting that people split the patch series apart as they slot things >> into the indicated places. In other words, it's not a patch series at >> all - it's a sprinkle of independent fixes. Are we OK thinking of it >> in that fashion? > > The common themes is "pagecache cannot handle > order-11", #1-3 tackle "ordinary" file THP, #4 tackles shmem THP. > > So I'm not sure we should be splitting it apart. It's just that shmem THP arrived before file THP :) > I rechecked the history, it's a bit hard to have precise fix tag for PATCH[4]. Please let me know if you have a better one for PATCH[4]. #4 Fixes: 800d8c63b2e9 ("shmem: add huge pages support") Cc: stable@kernel.org # v4.10+ Fixes: 552446a41661 ("shmem: Convert shmem_add_to_page_cache to XArray") Cc: stable@kernel.org # v4.20+ #3 Fixes: 793917d997df ("mm/readahead: Add large folio readahead") Cc: stable@kernel.org # v5.18+ #2 Fixes: 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings") Cc: stable@kernel.org # v5.18+ #1 Fixes: 793917d997df ("mm/readahead: Add large folio readahead") Cc: stable@kernel.org # v5.18+ I probably need to move PATCH[3] before PATCH[2] since PATCH[1] and PATCH[2] point to same commit. Thanks, Gavin
On Wed, 26 Jun 2024 10:37:00 +1000 Gavin Shan <gshan@redhat.com> wrote: > > I rechecked the history, it's a bit hard to have precise fix tag for PATCH[4]. > Please let me know if you have a better one for PATCH[4]. > > #4 > Fixes: 800d8c63b2e9 ("shmem: add huge pages support") > Cc: stable@kernel.org # v4.10+ > Fixes: 552446a41661 ("shmem: Convert shmem_add_to_page_cache to XArray") > Cc: stable@kernel.org # v4.20+ > #3 > Fixes: 793917d997df ("mm/readahead: Add large folio readahead") > Cc: stable@kernel.org # v5.18+ > #2 > Fixes: 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings") > Cc: stable@kernel.org # v5.18+ > #1 > Fixes: 793917d997df ("mm/readahead: Add large folio readahead") > Cc: stable@kernel.org # v5.18+ > > I probably need to move PATCH[3] before PATCH[2] since PATCH[1] and PATCH[2] > point to same commit. OK, thanks. I assume you'll be sending a new revision of the series. And Ryan had comments. Please incorporate the above into the updated changelogs as best you can.
On Wed, Jun 26, 2024 at 10:37:00AM +1000, Gavin Shan wrote: > On 6/26/24 5:05 AM, David Hildenbrand wrote: > > On 25.06.24 20:58, Andrew Morton wrote: > > > On Tue, 25 Jun 2024 20:51:13 +0200 David Hildenbrand <david@redhat.com> wrote: > > > > > > > > I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A > > > > > problem with this approach is that we're putting a basically untested > > > > > combination into -stable: 1&2 might have bugs which were accidentally > > > > > fixed in 3&4. A way to avoid this is to add cc:stable to all four > > > > > patches. > > > > > > > > > > What are your thoughts on this matter? > > > > > > > > Especially 4 should also be CC stable, so likely we should just do it > > > > for all of them. > > > > > > Fine. A Fixes: for 3 & 4 would be good. Otherwise we're potentially > > > asking for those to be backported further than 1 & 2, which seems > > > wrong. > > > > 4 is shmem fix, which likely dates back a bit longer. > > > > > > > > Then again, by having different Fixes: in the various patches we're > > > suggesting that people split the patch series apart as they slot things > > > into the indicated places. In other words, it's not a patch series at > > > all - it's a sprinkle of independent fixes. Are we OK thinking of it > > > in that fashion? > > > > The common themes is "pagecache cannot handle > order-11", #1-3 tackle "ordinary" file THP, #4 tackles shmem THP. > > > > So I'm not sure we should be splitting it apart. It's just that shmem THP arrived before file THP :) > > > > I rechecked the history, it's a bit hard to have precise fix tag for PATCH[4]. > Please let me know if you have a better one for PATCH[4]. > > #4 > Fixes: 800d8c63b2e9 ("shmem: add huge pages support") > Cc: stable@kernel.org # v4.10+ > Fixes: 552446a41661 ("shmem: Convert shmem_add_to_page_cache to XArray") > Cc: stable@kernel.org # v4.20+ > #3 > Fixes: 793917d997df ("mm/readahead: Add large folio readahead") > Cc: stable@kernel.org # v5.18+ > #2 > Fixes: 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings") > Cc: stable@kernel.org # v5.18+ > #1 > Fixes: 793917d997df ("mm/readahead: Add large folio readahead") > Cc: stable@kernel.org # v5.18+ I actually think it's this: commit 6b24ca4a1a8d Author: Matthew Wilcox (Oracle) <willy@infradead.org> Date: Sat Jun 27 22:19:08 2020 -0400 mm: Use multi-index entries in the page cache We currently store large folios as 2^N consecutive entries. While this consumes rather more memory than necessary, it also turns out to be buggy. A writeback operation which starts within a tail page of a dirty folio will not write back the folio as the xarray's dirty bit is only set on the head index. With multi-index entries, the dirty bit will be found no matter where in the folio the operation starts. This does end up simplifying the page cache slightly, although not as much as I had hoped. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Before this, we could split an arbitrary size folio to order 0. After it, we're limited to whatever the xarray allows us to split.
On 6/27/24 6:38 AM, Andrew Morton wrote: > On Wed, 26 Jun 2024 10:37:00 +1000 Gavin Shan <gshan@redhat.com> wrote: >> >> I rechecked the history, it's a bit hard to have precise fix tag for PATCH[4]. >> Please let me know if you have a better one for PATCH[4]. >> >> #4 >> Fixes: 800d8c63b2e9 ("shmem: add huge pages support") >> Cc: stable@kernel.org # v4.10+ >> Fixes: 552446a41661 ("shmem: Convert shmem_add_to_page_cache to XArray") >> Cc: stable@kernel.org # v4.20+ >> #3 >> Fixes: 793917d997df ("mm/readahead: Add large folio readahead") >> Cc: stable@kernel.org # v5.18+ >> #2 >> Fixes: 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings") >> Cc: stable@kernel.org # v5.18+ >> #1 >> Fixes: 793917d997df ("mm/readahead: Add large folio readahead") >> Cc: stable@kernel.org # v5.18+ >> >> I probably need to move PATCH[3] before PATCH[2] since PATCH[1] and PATCH[2] >> point to same commit. > > OK, thanks. > > I assume you'll be sending a new revision of the series. And Ryan had > comments. Please incorporate the above into the updated changelogs as > best you can. > Yes, I will post a new revision where all pending comments will be addressed. Thanks, Gavin
On 6/27/24 6:54 AM, Matthew Wilcox wrote: > On Wed, Jun 26, 2024 at 10:37:00AM +1000, Gavin Shan wrote: >> On 6/26/24 5:05 AM, David Hildenbrand wrote: >>> On 25.06.24 20:58, Andrew Morton wrote: >>>> On Tue, 25 Jun 2024 20:51:13 +0200 David Hildenbrand <david@redhat.com> wrote: >>>> >>>>>> I could split them and feed 1&2 into 6.10-rcX and 3&4 into 6.11-rc1. A >>>>>> problem with this approach is that we're putting a basically untested >>>>>> combination into -stable: 1&2 might have bugs which were accidentally >>>>>> fixed in 3&4. A way to avoid this is to add cc:stable to all four >>>>>> patches. >>>>>> >>>>>> What are your thoughts on this matter? >>>>> >>>>> Especially 4 should also be CC stable, so likely we should just do it >>>>> for all of them. >>>> >>>> Fine. A Fixes: for 3 & 4 would be good. Otherwise we're potentially >>>> asking for those to be backported further than 1 & 2, which seems >>>> wrong. >>> >>> 4 is shmem fix, which likely dates back a bit longer. >>> >>>> >>>> Then again, by having different Fixes: in the various patches we're >>>> suggesting that people split the patch series apart as they slot things >>>> into the indicated places. In other words, it's not a patch series at >>>> all - it's a sprinkle of independent fixes. Are we OK thinking of it >>>> in that fashion? >>> >>> The common themes is "pagecache cannot handle > order-11", #1-3 tackle "ordinary" file THP, #4 tackles shmem THP. >>> >>> So I'm not sure we should be splitting it apart. It's just that shmem THP arrived before file THP :) >>> >> >> I rechecked the history, it's a bit hard to have precise fix tag for PATCH[4]. >> Please let me know if you have a better one for PATCH[4]. >> >> #4 >> Fixes: 800d8c63b2e9 ("shmem: add huge pages support") >> Cc: stable@kernel.org # v4.10+ >> Fixes: 552446a41661 ("shmem: Convert shmem_add_to_page_cache to XArray") >> Cc: stable@kernel.org # v4.20+ >> #3 >> Fixes: 793917d997df ("mm/readahead: Add large folio readahead") >> Cc: stable@kernel.org # v5.18+ >> #2 >> Fixes: 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings") >> Cc: stable@kernel.org # v5.18+ >> #1 >> Fixes: 793917d997df ("mm/readahead: Add large folio readahead") >> Cc: stable@kernel.org # v5.18+ > > I actually think it's this: > > commit 6b24ca4a1a8d > Author: Matthew Wilcox (Oracle) <willy@infradead.org> > Date: Sat Jun 27 22:19:08 2020 -0400 > > mm: Use multi-index entries in the page cache > > We currently store large folios as 2^N consecutive entries. While this > consumes rather more memory than necessary, it also turns out to be buggy. > A writeback operation which starts within a tail page of a dirty folio will > not write back the folio as the xarray's dirty bit is only set on the > head index. With multi-index entries, the dirty bit will be found no > matter where in the folio the operation starts. > > This does end up simplifying the page cache slightly, although not as > much as I had hoped. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > Reviewed-by: William Kucharski <william.kucharski@oracle.com> > > Before this, we could split an arbitrary size folio to order 0. After > it, we're limited to whatever the xarray allows us to split. > Thanks, PATCH[4]'s fix tag will point to 6b24ca4a1a8d ("mm: Use multi-index entries in the page cache"), which was merged to v5.17. The fix tags for other patches are correct Thanks, Gavin