Re: [PATCH] arm64: enable THP_SWAP for arm64
From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2022-05-25 16:54:54
Also in:
linux-mm, lkml
On Wed, May 25, 2022 at 11:10:41PM +1200, Barry Song wrote:
On Wed, May 25, 2022 at 7:14 AM Catalin Marinas [off-list ref] wrote:quoted
I think this should work and with your other proposal it would be limited to MTE pages: #define arch_thp_swp_supported(page) (!test_bit(PG_mte_tagged, &page->flags)) Are THP pages loaded from swap as a whole or are they split? IIRC thei can confirm thp is written as a whole through: [ 90.622863] __swap_writepage+0xe8/0x580 [ 90.622881] swap_writepage+0x44/0xf8 [ 90.622891] pageout+0xe0/0x2a8 [ 90.622906] shrink_page_list+0x9dc/0xde0 [ 90.622917] shrink_inactive_list+0x1ec/0x3c8 [ 90.622928] shrink_lruvec+0x3dc/0x628 [ 90.622939] shrink_node+0x37c/0x6a0 [ 90.622950] balance_pgdat+0x354/0x668 [ 90.622961] kswapd+0x1e0/0x3c0 [ 90.622972] kthread+0x110/0x120 but i have never got a backtrace in which thp is loaded as a whole though it seems the code has this path: int swap_readpage(struct page *page, bool synchronous) { ... bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); bio->bi_iter.bi_sector = swap_page_sector(page); bio->bi_end_io = end_swap_bio_read; bio_add_page(bio, page, thp_size(page), 0); ... submit_bio(bio); }quoted
splitting still happens but after the swapping out finishes. Even if they are loaded as 4K pages, we still have the mte_save_tags() that only understands small pages currently, so rejecting THP pages is probably best.as anyway i don't have a mte-hardware to do a valid test to go any further, so i will totally disable thp_swp for hardware having mte for this moment in patch v2.
It makes sense. If we decide to improve this for MTE, we'll change the arch check. Thanks. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel