I have a theoretical question,What would happen if I clean up all the swap space while running,Would the operating system crash because of page faults that would happen in the kernel?
Cleaning swap space while running
kernel;swap
If you just mean running swapoff -a when you say clean up, then no.If you corrupt/overwrite the swap device/file, an application that gets swapped back in (with corrupted data) is very likely to crash, yes. The kernel does not get swapped out, so the system would not crash.