The Linux kernel OOM killer only acts if there's nothing left that can be discarded, which often happens way too late to save the system. You need a user-mode OOM-killer like earlyoom if you want to keep the system responsive.
I'm just saying turning on swap, or increasing the swap capacity does not fix the problem, and it usually makes it worse.
Without swap, the system lags for a couple seconds, OOM killer frees up memory and you're good to go again. The only slowdown is any pages that were kicked out from the file cache. But those quickly come back after the OOM killer does its thing.
I would view the OOm solution as a compute as cattle thinb, but here we are talking about a user desktop where the user can take the best action for themselves once they realize there's a problem.
The user doesn't decide which processes are swapped in. If the process gets CPU time and tries to access its data, that data will get swapped in.
> We are talking about a user desktop where the user can take the best action for themselves once they realize there's a problem.
You can't do that with swap, because once you realize there's a problem, you cannot even move your cursor or run commands to take any actions.