Page MenuHomeFreeBSD

malloc(9): introduce M_NEVERFREED
ClosedPublic

Authored by bnovkov on May 1 2024, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 25 2024, 9:29 PM
Unknown Object (File)
Nov 25 2024, 11:32 AM
Unknown Object (File)
Nov 24 2024, 10:36 PM
Unknown Object (File)
Nov 22 2024, 11:39 AM
Unknown Object (File)
Nov 21 2024, 7:41 AM
Unknown Object (File)
Nov 20 2024, 10:45 PM
Unknown Object (File)
Nov 20 2024, 7:27 AM
Unknown Object (File)
Nov 17 2024, 3:44 PM
Subscribers

Details

Summary

This patch adds an additional malloc(9) flag to distinguish UMA_ZONE_NOFREE allocations, as previously discussed in https://reviews.freebsd.org/D16620.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Why not M_NOFREE?

I believe that the addition require some (perhaps relatively comprehensive) explanation where to use the flag, and where not to. E.g. is it available to the casual malloc(9) user?

In D45045#1027214, @kib wrote:

Why not M_NOFREE?

M_NOFREE was already taken by sys/mbuf.h, M_NEVERFREED is one of the alternative names proposed by @alc .

I believe that the addition require some (perhaps relatively comprehensive) explanation where to use the flag, and where not to. E.g. is it available to the casual malloc(9) user?

I see this as more of an internal flag meant to be used by allocators rather than users. At the moment passing it to malloc(9) would effectively be a no-op as its only used by small_alloc.
I refrained from modifying the manpages until we discussed this collectively, but I'll definitely add an explanation once we settle on something.

Mentioning the supposed scope of use for flag in the review would be best. BTW if it is internal to vm allocators, why not call it M_VM_NOFREE?

This revision is now accepted and ready to land.May 3 2024, 12:36 AM

I'm fine with the name. It would indeed be good to document the flag further, at least in malloc.9.

This revision was automatically updated to reflect the committed changes.