[PATCH v5 3/7] malloc: force inline for single called functions

Cupertino Miranda cupertino.miranda@oracle.com
Fri Mar 21 12:00:58 GMT 2025


Change single called function definitions to us __always_inline instead
of the non guaranteed inline keyword.
---
 malloc/malloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index 98d1fda144..7f35f48769 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3245,7 +3245,7 @@ tcache_double_free_verify (tcache_entry *e, size_t tc_idx)
 
 /* Try to free chunk to the tcache, if success return true.
    Caller must ensure that chunk and size are valid.  */
-static inline bool
+static __always_inline bool
 tcache_free (mchunkptr p, INTERNAL_SIZE_T size)
 {
   bool done = false;
@@ -4556,7 +4556,7 @@ _int_malloc (mstate av, size_t bytes)
    ------------------------------ free ------------------------------
  */
 
-static inline void
+static __always_inline void
 _int_free_check (mstate av, mchunkptr p, INTERNAL_SIZE_T size)
 {
   /* Little security check which won't hurt performance: the
@@ -4690,7 +4690,7 @@ _int_free_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size, int have_lock)
    P has already been locked.  It will perform sanity check, then try the
    fast path to free into tcache.  If the attempt not success, free the
    chunk to arena.  */
-static inline void
+static __always_inline void
 _int_free (mstate av, mchunkptr p, int have_lock)
 {
   INTERNAL_SIZE_T size;        /* its size */
-- 
2.39.5



More information about the Libc-alpha mailing list