On 27/03/2024 08:32, Huang, Ying wrote: > Ryan Roberts <ryan.roberts@xxxxxxx> writes: > >> [...] >> >>>>> Test 1, sequential swapin/out of 30G zero page on ZRAM: >>>>> >>>>> Before (us) After (us) >>>>> Swapout: 33619409 33886008 >>>>> Swapin: 32393771 32465441 (- 0.2%) >>>>> Swapout (THP): 7817909 6899938 (+11.8%) >>>>> Swapin (THP) : 32452387 33193479 (- 2.2%) >>>> >>>> If my understanding were correct, we don't have swapin (THP) support, >>>> yet. Right? >>> >>> Yes, this series doesn't change how swapin/swapout works with THP in >>> general, but now THP swapout will leave shadows with large order, so >>> it needs to be splitted upon swapin, that will slow down later swapin >>> by a little bit but I think that's worth it. >>> >>> If we can do THP swapin in the future, this split on swapin can be >>> saved to make the performance even better. >> >> I'm confused by this (clearly my understanding of how this works is incorrect). >> Perhaps you can help me understand: >> >> When you talk about "shadows" I assume you are referring to the swap cache? It >> was my understanding that swapping out a THP would always leave the large folio >> in the swap cache, so this is nothing new? >> >> And on swap-in, if the target page is in the swap cache, even if part of a large >> folio, why does it need to be split? I assumed the single page would just be >> mapped? (and if all the other pages subsequently fault, then you end up with a >> fully mapped large folio back in the process)? >> >> Perhaps I'm misunderstanding what "shadows" are? > > Perhaps, shadow is used to support workingset protection/detection on > the anonymous LRU list as in the following patchset (merged). > > https://lore.kernel.org/all/1595490560-15117-5-git-send-email-iamjoonsoo.kim@xxxxxxx/T/#m962395eb5968c74b0c4c8e41d4b0dcdd3f28b2e6 Thanks! Although after reading the cover letter I still don't really understand the need for splitting. The LRU applies to whole folios. > > -- > Best Regards, > Huang, Ying