On Mon, Nov 20, 2023 at 3:17 AM Kairui Song <ryncsn@xxxxxxxxx> wrote: ime. > > Hi Ying, > > Thanks for the review! > > For the first issue "fragmented readahead window", I was planning to > do an extra check in readahead path to skip readahead entries that are That makes sense. The read ahead is an optional thing for speed optimization. If the read ahead crosses the swap device boundaries. The read ahead portion can be capped. > on different swap devices, which is not hard to do, but this series is > growing too long so I thought it will be better done later. > > For the second issue, "is there any practical use for multiple swap", > I think actually there are. For example we are trying to use multi > layer swap for offloading memory of different hotness on servers. And > we also tried to implement a mechanism to migrate long sleep swap > entries from high performance SSD/RAMDISK swap to cheap HDD swap > device, with more than two layers of swap, which worked except the > upstream issue, that readahead policy will no longer work as expected. Thank you very much for sharing your usage case. I am proposing "memory.swap.tiers" in this email thread: https://lore.kernel.org/linux-mm/CAF8kJuOD6zq2VPcVdoZGvkzYX8iXn1akuYhNDJx-LUdS+Sx3GA@xxxxxxxxxxxxxx/ It allows memcg to select which swap device/tiers it wants to opt in. Your SSD and HDD swap combination is what I have in mind as well. Chris