Ok, but still all this bio allocation and block layer overhead seemsIncreasing the frequency of discards is also not an option:That's fine, swap works under low memory conditions by using reserves.
- Creating discard bio requests themselves need memory and these
swap devices
come into picture only under low memory conditions.
unnecessary and is easily avoidable. I think frontswap code needs
clean up but at least it avoids all this bio overhead.
frontswap simply calls frontswap_flush_page() in swap_entry_free() i.e. as- We need to regularly scan swap_map to issue these discards.How does frontswap do this? Does it maintain its own data structures?
Increasing discard
frequency also means more frequent scanning (which will still not be
fast enough
for ramzswap needs).
soon as a swap slot is freed. No bio allocation etc.
Even for copying to RAM an async API is wanted, so you can dma itMaybe incremental development is better? Stabilize and refine existing
instead of copying.
code and gradually move to async API, if required in future?