Re: [RFC PATCH 00/10] mm/swap: always use swap cache for synchronization
From: Ryan Roberts
Date: Wed Mar 27 2024 - 04:29:09 EST
[...]
>>> 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?