Too much RAM used for wired memory

From: porsolic <porsolic_at_gmail.com>
Date: Tue, 23 Aug 2022 18:48:35 UTC
My PC uses too much wired memory after few days.
After two weeks of uptime, wired memory usage is more than 50% of my RAM
(17G Wired, 32 GB of physical RAM)
PC is used with ZFS, 1 VM (bhyve, 1 CPU, 256 MB of RAM, passthru PCIe LAN
card, pinned to 1 phy CPU, priority/nice is -10), Xorg, multiple Firefox
instances (one used for playing videos), work in shell (zsh, tmux, vim,
...), GUI filemanager, GUI PDF reader and sometimes with KiCAD and/or WINE.

Even after stopping VM, all programs, Xorg, tmux, dbus, avahi, moused,
cups, other daemons, exporting non-root ZFS pool, going to single user mode
- wired memory still doesn't decrease

man vmstat shows:
-z      Report on memory used by the kernel zone allocator, uma(9), by zone.

Is that the same as wired memory?

How can I see what exactly is using that much of wired memory?
What metrics should I use to pinpoint issue? vmstat? sysctl counters?

# uname -srpKU
FreeBSD 13.1-RELEASE amd64 1301000 1301000

# top -nSz | head -6
last pid:  1884;  load averages:  2.57,  2.96,  2.91  up 15+05:21:55
 15:00:00
191 processes: 5 running, 184 sleeping, 1 zombie, 1 waiting
CPU:  5.1% user,  0.0% nice,  4.2% system,  0.1% interrupt, 90.7% idle
Mem: 6136M Active, 3218M Inact, 1986M Laundry, 17G Wired, 96K Buf, 719M Free
ARC: 1513M Total, 548M MFU, 419M MRU, 11M Anon, 17M Header, 517M Other
     464M Compressed, 633M Uncompressed, 1.36:1 Ratio

# vmstat -s | grep wired
  4354572 pages wired down
    65537 virtual user pages wired down

# vmstat -m | (head -n1 && sort -hk3 | tail -5)
         Type InUse MemUse Requests  Size(s)
        vtbuf    24  4560K       70  4096
        linux 52226 17342K 2088029157
 16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
        amdvi 16924 67689K    16924  32,4096
      solaris 888982 303053K 5679401089
 16,32,64,128,256,384,512,1024,2048,4096,8192,16384,32768,65536
      drm_kms 18446744073709504758 18014398509470267K       14  64

# vmstat -z | sort -t , -k3 | (head -n1 && tail -5)
ITEM                   SIZE  LIMIT     USED     FREE      REQ     FAILSLEEP
XDOMAIN
malloc-384:             384,      0,  368738,    1982,1477234413,   0,   0,
  0
dnode_t:                816,      0,  383683,     192,235818160,   0,   0,
  0
dmu_buf_impl_t:         296,      0,  386372,   27938,569079198,   0,   0,
  0
vm pgcache:            4096,      0,  646128,    1726,2444497080,66010,
0,   0
vm pgcache:            4096,      0, 6560096,    4312,6998441782,53699,
0,   0

# zfs-stats -MA

------------------------------------------------------------------------
ZFS Subsystem Report Tue Aug 23 15:00:00 2022
------------------------------------------------------------------------

System Memory:

20.73% 5.99 GiB Active, 10.87% 3.14 GiB Inact
57.45% 16.61 GiB Wired, 0.00% 0 Bytes Cache
2.40% 709.61 MiB Free, 8.56% 2.47 GiB Gap

Real Installed: 32.00 GiB
Real Available: 92.97% 29.75 GiB
Real Managed: 97.19% 28.92 GiB

Logical Total: 32.00 GiB
Logical Used: 88.01% 28.16 GiB
Logical Free: 11.99% 3.84 GiB

Kernel Memory: 16.00 EiB
Data: 100.00% 16.00 EiB
Text: 0.00% 49.03 MiB

Kernel Memory Map: 4.00 GiB
Size: 63.11% 2.52 GiB
Free: 36.89% 1.48 GiB

------------------------------------------------------------------------

ARC Summary: (HEALTHY)
Memory Throttle Count: 0

ARC Misc:
Deleted: 39.87 m
Mutex Misses: 7.69 m
Evict Skips: 3.07 b

ARC Size: 36.95% 1.48 GiB
Target Size: (Adaptive) 28.12% 1.12 GiB
Min Size (Hard Limit): 23.24% 952.04 MiB
Max Size (High Water): 4:1 4.00 GiB
Compressed Data Size: 464.17 MiB
Decompressed Data Size: 632.91 MiB
Compression Factor: 1.36

ARC Size Breakdown:
Recently Used Cache Size: 55.47% 839.54 MiB
Frequently Used Cache Size: 44.53% 673.85 MiB

ARC Hash Breakdown:
Elements Max: 448.86 k
Elements Current: 12.85% 57.67 k
Collisions: 2.04 m
Chain Max: 5
Chains: 408

------------------------------------------------------------------------