Page MenuHomeFreeBSD

malloc(9): introduce M_NEVERFREED
AcceptedPublic

Authored by bnovkov on May 1 2024, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 14, 8:52 PM
Unknown Object (File)
Fri, Jul 5, 2:27 AM
Unknown Object (File)
Jun 13 2024, 6:29 PM
Unknown Object (File)
May 29 2024, 8:23 AM
Unknown Object (File)
May 27 2024, 2:14 AM
Unknown Object (File)
May 13 2024, 7:10 AM
Unknown Object (File)
May 10 2024, 3:50 AM
Unknown Object (File)
May 9 2024, 1:27 AM
Subscribers

Details

Reviewers
kib
alc
markj
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 Skipped
Unit
Tests Skipped

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.