]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
aio: Improve UMA usage
authorMark Johnston <markj@FreeBSD.org>
Mon, 20 Jun 2022 16:17:11 +0000 (12:17 -0400)
committerMark Johnston <markj@FreeBSD.org>
Mon, 20 Jun 2022 16:48:13 +0000 (12:48 -0400)
commit9553bc89dbc38a861a750ddc605cec0381788c5d
tree8607c7bece1da317ac8ce1256b3cced6ecd18cef
parent60b4ad4b6b561ac2d9129a3576a74db3607ad90c
aio: Improve UMA usage

- Remove the AIO proc zone.  This zone gets one allocation per AIO
  daemon process, which isn't enough to warrant a dedicated zone.  Plus,
  unlike other AIO structures, aiops are small (32 bytes with LP64), so
  UMA doesn't provide better space efficiency than malloc(9).  Change
  one of the malloc types in vfs_aio.c to make it more general.

- Don't set the NOFREE flag on the other AIO zones.  This flag means
  that memory allocated to the AIO subsystem is never freed back to the
  VM, so it's always preferable to avoid using it when possible.  NOFREE
  was set without explanation when AIO was converted to use UMA 20 years
  ago, but it does not appear to be required; all of the structures
  allocated from UMA (per-process kaioinfo, kaiocb, and aioliojob) keep
  track of references and get freed only when none exist.  Plus, these
  structures will contain dangling pointer after they're freed (e.g.,
  the "cred", "fd_file" and "uiop" fields of struct kaiocb), so
  use-after-frees are dangerous even when the structures themselves are
  type-stable.

Reviewed by: asomers
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35493
sys/kern/vfs_aio.c