Page MenuHomeFreeBSD

malloc(9): Document/add aligned variants
ClosedPublic

Authored by adam_fenn.io on Jul 2 2021, 9:27 PM.
Tags
None
Referenced Files
F84241909: D31004.id.diff
Tue, May 21, 8:00 AM
F84234052: D31004.diff
Tue, May 21, 4:49 AM
Unknown Object (File)
Mon, May 20, 6:58 PM
Unknown Object (File)
Sat, May 18, 2:17 AM
Unknown Object (File)
Mar 8 2024, 11:41 PM
Unknown Object (File)
Mar 8 2024, 11:41 PM
Unknown Object (File)
Mar 8 2024, 11:41 PM
Unknown Object (File)
Mar 8 2024, 11:41 PM

Details

Summary

As per https://reviews.freebsd.org/D29733#696995 and https://reviews.freebsd.org/D29733#696995, introduce malloc_aligned() and add this and malloc_domainset_aligned() to malloc(9).

Test Plan

Tested via a version of https://reviews.freebsd.org/differential/diff/91630/ with the following modification in kvm_clock_attach():

-	sc->timeinfos = malloc_domainset_aligned(round_page(mp_ncpus *
+	sc->timeinfos = malloc_aligned(round_page(mp_ncpus *
 	    sizeof(struct pvclock_vcpu_time_info)), PAGE_SIZE, M_DEVBUF,
-	    DOMAINSET_RR(), M_WAITOK | M_ZERO);
+	    M_WAITOK | M_ZERO);

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40245
Build 37134: arc lint + arc unit

Event Timeline

adam_fenn.io held this revision as a draft.
share/man/man9/malloc.9
74

You can use .Fo to avoid this long line

99

It would be useful to note that:

  • align should be non-zero and power of two
  • we only support align requests less or equal to the page size
This revision is now accepted and ready to land.Jul 3 2021, 12:21 AM
allanjude added a subscriber: allanjude.

Man page changes approved

This revision was automatically updated to reflect the committed changes.