[PATCH v2] malloc: Use __always_inline for simple functions
DJ Delorie
dj@redhat.com
Tue Mar 25 19:23:21 GMT 2025
Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> After search&replace __always_inline looked wrong here. However the
> implementations used __always_inline before my patch, so __always_inline
> is more accurate (not that it makes a difference as it's a declaration).
Those aren't performance-critical, so I think it doesn't matter if
they're inline or not. Changing "inline" to "always_inline" is at least
consistent.
>> -static inline void
>> +static /*__always_inline*/ void
>> madvise_thp (void *p, INTERNAL_SIZE_T size)
>>
>> Er, what?
>
> Oops - I wasn't sure which inlining variant would be best here, so this was
> a leftover experiment to see whether it makes a difference. I have kept it as
> "inline" for now in v2.
Heh :-)
LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>
> -static inline size_t
> +static __always_inline size_t
> heap_min_size (void)
> {
Ok.
> -static inline size_t
> +static __always_inline size_t
> heap_max_size (void)
> {
Ok.
>
> -static inline heap_info *
> +static __always_inline heap_info *
> heap_for_ptr (void *ptr)
> {
Ok.
> -static inline struct malloc_state *
> +static __always_inline struct malloc_state *
> arena_for_chunk (mchunkptr ptr)
> {
Ok.
>
> #define TUNABLE_CALLBACK_FNDECL(__name, __type) \
> -static inline int do_ ## __name (__type value); \
> -static void \
> +static __always_inline int do_ ## __name (__type value); \
> +static void \
> TUNABLE_CALLBACK (__name) (tunable_val_t *valp) \
Ok.
> -static inline size_t
> +static __always_inline size_t
> checked_request2size (size_t req) __nonnull (1)
> {
Ok.
> -static inline INTERNAL_SIZE_T
> +static __always_inline INTERNAL_SIZE_T
> get_max_fast (void)
> {
Ok.
> -static inline bool
> +static __always_inline bool
> tcache_free (mchunkptr p, INTERNAL_SIZE_T size)
> {
Ok.
> -static inline void
> +static __always_inline void
> _int_free_check (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
> {
Ok.
> -static inline void
> +static __always_inline void
> _int_free (mstate av, mchunkptr p, int have_lock)
> {
> INTERNAL_SIZE_T size; /* its size */
Ok.
More information about the Libc-alpha
mailing list