Re: curious crashes when under memory pressure

From: Karl Denninger <karl_at_denninger.net>
Date: Sat, 04 Jan 2025 18:23:59 UTC
On 1/4/2025 1:08 PM, Craig Leres wrote:
> On 1/4/25 09:36, Karl Denninger wrote:
>> What's the argument for swapping to a mirror in the first place? If 
>> the issue is throughput IMHO the answer is to swap to multiple devices.
>
> I thought the idea here is if your swap is not redundant and it goes 
> away the system crashes (or otherwise misbehaves)?
>
Well, yes.

How often do you have storage failures? Oh they happen and are the 
reason you run mirrors and ZFS and similar for actual data you care 
about but if I've got a bad volume that is being swapped to I want it 
out of there and its extremely unlikely to lead to any sort of silent 
corruption (an actual I/O error probably will lead to a panic.)

Further if I take such a hit on a system that is heavily using swap the 
performance whack during the resilver is likely to be extreme enough to 
screw up my workload.  I'd rather shut down and replace the bad device 
in that rare but possible instance.

Putting swap through a process that requires memory allocation (e.g. on 
a ZFS zvol) risks it failing due to the inability of that codepath to 
allocate memory when it needs it thus killing at least some process 
(maybe the one that caused the page-out, maybe the victim that was 
selected to be paged out) which you seem to be experiencing and there is 
risk (if there's any pathology in there) of a panic or (worse) a deadlock.

IMHO I'd run the swap directly to disk slices adding multiple swap 
devices if the space requirement for doing so is appropriate (which 
could be an entire device for each depending on requirements) and if you 
insist on mirroring it (although I think its likely a mistake to do so) 
then use something like gmirror as that is much lighter-weight and 
should not be subject to requiring material RAM allocation when you're 
already short on it.

-- 
Karl Denninger
karl@denninger.net
/The Market Ticker/
/[S/MIME encrypted email preferred]/