freebsd-dev/sys/geom
Gleb Smirnoff 2dbc9a388e Fix memory deadlock when GELI partition is used for swap.
When we get low on memory, the VM system tries to free some by swapping
pages. However, if we are so low on free pages that GELI allocations block,
then the swapout operation cannot complete. This keeps the VM system from
being able to free enough memory so the allocation can complete.

To alleviate this, keep a UMA pool at the GELI layer which is used for data
buffer allocation in the fast path, and reserve some of that memory for swap
operations. If an IO operation is a swap, then use the reserved memory. If
the allocation still fails, return ENOMEM instead of blocking.

For non-swap allocations, change the default to using M_NOWAIT. In general,
this *should* be better, since it gives upper layers a signal of the memory
pressure and a chance to manage their failure strategy appropriately. However,
a user can set the kern.geom.eli.blocking_malloc sysctl/tunable to restore
the previous M_WAITOK strategy.

Submitted by:		jtl
Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D24400
2021-09-28 11:23:52 -07:00
..
bde gbde: replace malloc_last_fail with a kludge 2020-11-12 20:20:57 +00:00
cache geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-10 20:18:46 -04:00
concat gconcat: Zero the metadata block before writing 2021-07-13 17:45:59 -04:00
eli Fix memory deadlock when GELI partition is used for swap. 2021-09-28 11:23:52 -07:00
gate geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
journal Fix some common typos in source code comments 2021-08-28 18:57:23 +02:00
label g_label: Handle small sector sizes when tasting 2021-09-07 11:19:29 -04:00
linux_lvm Make g_attach() return ENXIO for orphaned providers; update various 2020-10-18 16:24:08 +00:00
mirror gmirror: Zero the metadata block before writing 2021-07-13 17:45:57 -04:00
mountver Make g_attach() return ENXIO for orphaned providers; update various 2020-10-18 16:24:08 +00:00
multipath gmultipath: make physpath distinct from the underlying providers' 2021-05-06 12:32:27 -06:00
nop Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
part Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
raid graid: Avoid tasting devices with small sector sizes 2021-08-31 17:09:52 -04:00
raid3 graid3: Zero the metadata block before writing 2021-07-13 17:46:02 -04:00
shsec Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
stripe geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-10 20:18:46 -04:00
uzip Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
vinum Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
virstor Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
zero geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-10 20:18:46 -04:00
geom_bsd_enc.c
geom_ccd.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_ctl.c geom_ctl.c: remove stale header files 2020-10-20 20:59:13 +00:00
geom_ctl.h Define a constant for the maximum number of GEOM_CTL arguments. 2019-02-20 17:07:08 +00:00
geom_dbg.h GEOM: Reduce unnecessary log interleaving with sbufs 2019-08-07 19:28:35 +00:00
geom_dev.c Make MAXPHYS tunable. Bump MAXPHYS to 1M. 2020-11-28 12:12:51 +00:00
geom_disk.c geom_disk: Add KMSAN checks 2021-08-11 16:33:41 -04:00
geom_disk.h Use a more specific type for geom_disk.d_event. 2021-07-29 16:34:46 -07:00
geom_dump.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_event.c geom: create an API to allocate events, and use that storage to send them 2021-07-23 18:08:45 -06:00
geom_flashmap.c Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
geom_flashmap.h geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_int.h Remove duplicate g_debugflags declaration. 2019-12-05 15:07:32 +00:00
geom_io.c Add flag BIO_SWAP to mark IOs that are associated with swap. 2021-09-28 11:23:51 -07:00
geom_kern.c geom(4): Mark all sysctls as CTLFLAG_MPSAFE. 2021-08-10 20:18:46 -04:00
geom_map.c geom: clean up empty lines in .c and .h files 2020-09-01 22:14:09 +00:00
geom_redboot.c geom_map and geom_redboot: Remove unused ctlreq handler. 2020-07-26 22:30:01 +00:00
geom_slice.c Pass BIO_SPEEDUP through all the geom layers 2020-01-17 01:15:55 +00:00
geom_slice.h
geom_subr.c geom(4): make g_newprovider_event() return if G_P_WITHER is set 2020-12-29 14:29:59 +00:00
geom_vfs.c geom_vfs: Pre-allocate event for g_vfs_destroy. 2021-07-29 17:09:23 -07:00
geom_vfs.h
geom.h geom: create an API to allocate events, and use that storage to send them 2021-07-23 18:08:45 -06:00
notes