]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
malloc: remove mallopt fastbin stats
authorDev Jain <dev.jain@arm.com>
Wed, 10 Dec 2025 14:56:37 +0000 (14:56 +0000)
committerWilco Dijkstra <wilco.dijkstra@arm.com>
Wed, 17 Dec 2025 15:32:53 +0000 (15:32 +0000)
In preparation for removal of fastbins, remove all fastbin code from
mallopt.

Reviewed-by: DJ Delorie <dj@redhat.com>
malloc/malloc.c
malloc/malloc.h

index fa854fc4b8f75b09902ea7ed1180487beb6e4683..99aa566277744e8a358c87650b1a3a240434703a 100644 (file)
@@ -660,12 +660,9 @@ void*  __libc_valloc(size_t);
 
   arena:     current total non-mmapped bytes allocated from system
   ordblks:   the number of free chunks
-  smblks:    the number of fastbin blocks (i.e., small chunks that
-              have been freed but not reused or consolidated)
   hblks:     current number of mmapped regions
   hblkhd:    total bytes held in mmapped regions
   usmblks:   always 0
-  fsmblks:   total bytes held in fastbin blocks
   uordblks:  current total allocated space (normal or mmapped)
   fordblks:  total free space
   keepcost:  the maximum number of bytes that could ideally be released
@@ -5041,9 +5038,7 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
   mbinptr b;
   mchunkptr p;
   INTERNAL_SIZE_T avail;
-  INTERNAL_SIZE_T fastavail;
   int nblocks;
-  int nfastblocks;
 
   check_malloc_state (av);
 
@@ -5051,26 +5046,6 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
   avail = chunksize (av->top);
   nblocks = 1;  /* top always exists */
 
-  /* traverse fastbins */
-  nfastblocks = 0;
-  fastavail = 0;
-
-  for (i = 0; i < NFASTBINS; ++i)
-    {
-      for (p = fastbin (av, i);
-          p != NULL;
-          p = REVEAL_PTR (p->fd))
-        {
-         if (__glibc_unlikely (misaligned_chunk (p)))
-           malloc_printerr ("int_mallinfo(): "
-                            "unaligned fastbin chunk detected");
-          ++nfastblocks;
-          fastavail += chunksize (p);
-        }
-    }
-
-  avail += fastavail;
-
   /* traverse regular bins */
   for (i = 1; i < NBINS; ++i)
     {
@@ -5082,12 +5057,10 @@ int_mallinfo (mstate av, struct mallinfo2 *m)
         }
     }
 
-  m->smblks += nfastblocks;
   m->ordblks += nblocks;
   m->fordblks += avail;
   m->uordblks += av->system_mem - avail;
   m->arena += av->system_mem;
-  m->fsmblks += fastavail;
   if (av == &main_arena)
     {
       m->hblks = mp_.n_mmaps;
@@ -5128,11 +5101,11 @@ __libc_mallinfo (void)
 
   m.arena = m2.arena;
   m.ordblks = m2.ordblks;
-  m.smblks = m2.smblks;
+  m.smblks = 0;
   m.hblks = m2.hblks;
   m.hblkhd = m2.hblkhd;
   m.usmblks = m2.usmblks;
-  m.fsmblks = m2.fsmblks;
+  m.fsmblks = 0;
   m.uordblks = m2.uordblks;
   m.fordblks = m2.fordblks;
   m.keepcost = m2.keepcost;
index 6de9ee8a7a1222dbc85af611c277317246e86df9..f3b0574041f7ebe2a87202d4edfed9b9e5fab193 100644 (file)
@@ -83,11 +83,11 @@ struct mallinfo
 {
   int arena;    /* non-mmapped space allocated from system */
   int ordblks;  /* number of free chunks */
-  int smblks;   /* number of fastbin blocks */
+  int smblks;   /* number of fastbin blocks (deprecated) */
   int hblks;    /* number of mmapped regions */
   int hblkhd;   /* space in mmapped regions */
   int usmblks;  /* always 0, preserved for backwards compatibility */
-  int fsmblks;  /* space available in freed fastbin blocks */
+  int fsmblks;  /* space available in freed fastbin blocks (deprecated) */
   int uordblks; /* total allocated space */
   int fordblks; /* total free space */
   int keepcost; /* top-most, releasable (via malloc_trim) space */
@@ -100,11 +100,11 @@ struct mallinfo2
 {
   size_t arena;    /* non-mmapped space allocated from system */
   size_t ordblks;  /* number of free chunks */
-  size_t smblks;   /* number of fastbin blocks */
+  size_t smblks;   /* number of fastbin blocks (deprecated) */
   size_t hblks;    /* number of mmapped regions */
   size_t hblkhd;   /* space in mmapped regions */
   size_t usmblks;  /* always 0, preserved for backwards compatibility */
-  size_t fsmblks;  /* space available in freed fastbin blocks */
+  size_t fsmblks;  /* space available in freed fastbin blocks (deprecated) */
   size_t uordblks; /* total allocated space */
   size_t fordblks; /* total free space */
   size_t keepcost; /* top-most, releasable (via malloc_trim) space */