kernel - Refactor swapoff scan code