mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Use __attribute__((malloc)) on memory allocation functions
This informs the C compiler that pointers returned from these functions do not alias other functions, which allows it to do better code optimization and should make the compiled code smaller. References: https://stackoverflow.com/a/53654773 https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute https://clang.llvm.org/docs/AttributeReference.html#malloc Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14827
This commit is contained in:
@@ -86,10 +86,15 @@ extern int zfs_abd_scatter_enabled;
|
||||
* Allocations and deallocations
|
||||
*/
|
||||
|
||||
__attribute__((malloc))
|
||||
abd_t *abd_alloc(size_t, boolean_t);
|
||||
__attribute__((malloc))
|
||||
abd_t *abd_alloc_linear(size_t, boolean_t);
|
||||
__attribute__((malloc))
|
||||
abd_t *abd_alloc_gang(void);
|
||||
__attribute__((malloc))
|
||||
abd_t *abd_alloc_for_io(size_t, boolean_t);
|
||||
__attribute__((malloc))
|
||||
abd_t *abd_alloc_sametype(abd_t *, size_t);
|
||||
boolean_t abd_size_alloc_linear(size_t);
|
||||
void abd_gang_add(abd_t *, abd_t *, boolean_t);
|
||||
|
||||
Reference in New Issue
Block a user