Re: curious crashes when under memory pressure

From: Chris Torek <chris.torek_at_gmail.com>
Date: Sun, 05 Jan 2025 05:33:04 UTC
On Sat, Jan 4, 2025 at 2:04 PM Craig Leres <leres@freebsd.org> wrote:
> Chris said he was "swapping to a zfs mirror" but I'm swapping to a gmirror.

I thought I was, but now I'm not sure any more :-) (I set this up many
months ago). Poking around, it looks like I have a three way geom
mirror (why 3? I have no idea, well, some vague idea, but, well...).

I have `/dev/mirror/swap` as the swapon device in `/etc/fstab`, and
`gmirror list` says:

Geom name: swap
State: COMPLETE
Components: 3
Balance: load
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 777312945
Type: AUTOMATIC
Providers:
1. Name: mirror/swap
   Mediasize: 137438952960 (128G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0
Consumers:
1. Name: ada2p3
   Mediasize: 137438953472 (128G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e1
   State: ACTIVE
   Priority: 2
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 466179938
[repeat for ada1p3 and ada0p3 but with priorities counting down to 0
and with different IDs.]

So I guess I'm swapping to a geom mirror. I suspect it has three
drives in it because I was originally thinking I had to swap to a zfs
vdev mirror.

You can stop here, but if not: MORE DETAILS

I originally put four drives in the machine (3 8TB + 1 old 2 TB), and
only three were working (ada0 through 2), so I set up a three-way zfs
file system on it. The fourth one worked on Linux but not on FreeBSD.
Eventually I moved it to a different channel and it started working
fine and I still don't know what that's all about, though there were
several kernel updates along the way (patch releases of FreeBSD 14) as
well.

At some point I discovered you can't crash-dump to a mirror, so I set
up a 64 GB partition on ada3 and made it the dump device. It might not
be working, I haven't forcibly tested it yet. Worse,  `gpart show -l`
shows it as `swap2`, a duplicate of ada2's `swap2` except half the
size (??). It shows up fine as /dev/label/crash though.

`geom swap list -a` says:

Geom name: swap
Consumers:
1. Name: mirror/swap
   Mediasize: 137438952960 (128G)
   Sectorsize: 512
   Stripesize: 4096
   Stripeoffset: 0
   Mode: r1w1e0

Strippng `geom -t` output a bit (egrep disk\|swap):

    ada3p2                 LABEL      gpt/swap2
      gpt/swap2            DEV
    swap                   MIRROR     mirror/swap
      mirror/swap          DEV
      swap                 SWAP
    swap                   MIRROR     mirror/swap
      mirror/swap          DEV
      swap                 SWAP
    swap                   MIRROR     mirror/swap
      mirror/swap          DEV
      swap                 SWAP
swap.sync                  MIRROR

Here's `gpart show -p  | grep swap`:

        2048   134217728  ada3p2  freebsd-swap  (64G)
       534528    268435456  ada2p3  freebsd-swap  (128G)
       534528    268435456  ada1p3  freebsd-swap  (128G)
       534528    268435456  ada0p3  freebsd-swap  (128G)

and `gpart show -l | grep swap`:

        2048   134217728     2  swap2  (64G)
       534528    268435456     3  swap2  (128G)
       534528    268435456     3  swap1  (128G)
       534528    268435456     3  swap0  (128G)

I went straight from an original FreeBSD 9 setup with an ancient MBR
(persisting unchanged through several upgrades) to FreeBSD 14 (now 15)
at home, so I get a bit lost between gpart, geom, and zfs/zpool
differences at times.

Chris