* Nitin Gupta<ngupta@xxxxxxxxxx> wrote:
(Re-sending since I didn't get any reply last time)
Currently, we have "swap discard" mechanism which sends a discard
bio request when we find a free cluster during scan_swap_map().
This callback can come a long time after swap slots are actually
freed.
This delay in callback is a great problem when (compressed) RAM
[1] is used as a swap device. So, this change adds a callback
which is called as soon as a swap slot becomes free. For above
mentioned case of swapping over compressed RAM device, this is
very useful since we can immediately free memory allocated for
this swap page.
This callback does not replace swap discard support. It is called
with swap_lock held, so it is meant to trigger action that
finishes quickly. However, swap discard is an I/O request and can
be used for taking longer actions.
Shouldnt this be all be unconditional? Sounds like a reasonable VM
callback. The patch would become a lot smaller as well.