ksize() gets the actual amount of memory allocated for a given object and is used once in drm-kmod (drivers/dma-buf/reservation.c) to align C99 flexible array size with UMA zone item size.
This patch is borrowed from kern_malloc.c and allows to strip "#ifdef _ _FreeBSD_ _" from aforementioned drm-kmod's file. Quick test shows no positive effect from better array size alignment at least in my setup.
Details
Details
- Reviewers
• hselasky manu kib - Group Reviewers
manpages - Commits
- rS365383: MFC r364964: LinuxKPI: Implement ksize() function.
rS364964: LinuxKPI: Implement ksize() function.
Test allocation sizes with GENERIC kernel config and with DEBUG_MEMGUARD and DEBUG_REDZONE options enabled.
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
I suppose this was extracted from realloc(9) ?
I dislike the addition of code that knows so much about internals of malloc(9), into linuxkpi. I suggest to move this function to kern_malloc.c as is and name it e.g. malloc_usable_size(), since this is the usermode name for the same functionality. Then linuxkpi is just a renaming macro.
sys/compat/linuxkpi/common/include/linux/slab.h | ||
---|---|---|
193 | Can we drop all that extern from function declarations in linuxkpi ? |