This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26.9000-759-g34eb415


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  34eb41579c6c34fa60ec6f1aac7b70ba6e1bebcc (commit)
      from  7a9368a1174cb15b9f1d6342e0e10dd90dae238d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=34eb41579c6c34fa60ec6f1aac7b70ba6e1bebcc

commit 34eb41579c6c34fa60ec6f1aac7b70ba6e1bebcc
Author: Florian Weimer <fweimer@redhat.com>
Date:   Wed Nov 15 11:40:41 2017 +0100

    malloc: Account for all heaps in an arena in malloc_info [BZ #22439]
    
    This commit adds a "subheaps" field to the malloc_info output that
    shows the number of heaps that were allocated to extend a non-main
    arena.
    
    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

diff --git a/ChangeLog b/ChangeLog
index a0e0d07..7032850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2017-11-15  Florian Weimer  <fweimer@redhat.com>
 
+	[BZ #22439]
+	* malloc/malloc.c (__malloc_info): Count all heaps in an arena,
+	not just the top one.  Output a new "subheaps" statistic.
+
+2017-11-15  Florian Weimer  <fweimer@redhat.com>
+
 	[BZ #22408]
 	* malloc/malloc.c (__malloc_info): Obtain arena heap statistics
 	under the per-arena lock.
diff --git a/NEWS b/NEWS
index b728162..520db40 100644
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,9 @@ Deprecated and removed features, and other changes affecting compatibility:
 * The res_hnok, res_dnok, res_mailok and res_ownok functions now check that
   the specified string can be parsed as a domain name.
 
+* In the malloc_info output, the <heap> element may contain another <aspace>
+  element, "subheaps", which contains the number of sub-heaps.
+
 Changes to build and runtime requirements:
 
   [Add changes to build and runtime requirements here]
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0494e8c..2999ac4 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5457,11 +5457,19 @@ __malloc_info (int options, FILE *fp)
 
       size_t heap_size = 0;
       size_t heap_mprotect_size = 0;
+      size_t heap_count = 0;
       if (ar_ptr != &main_arena)
 	{
+	  /* Iterate over the arena heaps from back to front.  */
 	  heap_info *heap = heap_for_ptr (top (ar_ptr));
-	  heap_size = heap->size;
-	  heap_mprotect_size = heap->mprotect_size;
+	  do
+	    {
+	      heap_size += heap->size;
+	      heap_mprotect_size += heap->mprotect_size;
+	      heap = heap->prev;
+	      ++heap_count;
+	    }
+	  while (heap != NULL);
 	}
 
       __libc_lock_unlock (ar_ptr->mutex);
@@ -5499,8 +5507,9 @@ __malloc_info (int options, FILE *fp)
 	{
 	  fprintf (fp,
 		   "<aspace type=\"total\" size=\"%zu\"/>\n"
-		   "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
-		   heap_size, heap_mprotect_size);
+		   "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
+		   "<aspace type=\"subheaps\" size=\"%zu\"/>\n",
+		   heap_size, heap_mprotect_size, heap_count);
 	  total_aspace += heap_size;
 	  total_aspace_mprotect += heap_mprotect_size;
 	}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    6 ++++++
 NEWS            |    3 +++
 malloc/malloc.c |   17 +++++++++++++----
 3 files changed, 22 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]