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)
Sat, Nov 9, 4:18 PM
Unknown Object (File)
Thu, Nov 7, 2:58 PM
Unknown Object (File)
Tue, Oct 29, 6:51 AM
Unknown Object (File)
Fri, Oct 18, 2:06 PM
Unknown Object (File)
Thu, Oct 17, 1:46 AM
Unknown Object (File)
Mon, Oct 14, 7:25 PM
Unknown Object (File)
Mon, Oct 14, 2:43 PM
Unknown Object (File)
Sun, Oct 13, 2:08 AM
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 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.

This revision was automatically updated to reflect the committed changes.