This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch lxoliva/malloc-probes-bz742038.stgit created. glibc-2.18-88-g52390f3
- From: aoliva at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 13 Aug 2013 18:49:51 -0000
- Subject: GNU C Library master sources branch lxoliva/malloc-probes-bz742038.stgit created. glibc-2.18-88-g52390f3
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, lxoliva/malloc-probes-bz742038.stgit has been created
at 52390f310c9ae6fc68b747fc5309e3338856e6eb (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=52390f310c9ae6fc68b747fc5309e3338856e6eb
commit 52390f310c9ae6fc68b747fc5309e3338856e6eb
Merge: 380b4e6 ee39d66 5e09aee
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:41 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=380b4e64538ebeae131d41158b8a245fa3a054b2
commit 380b4e64538ebeae131d41158b8a245fa3a054b2
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:41 2013 -0300
push
diff --git a/meta b/meta
index 179ffda..26b9175 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 3aa08e8edbddbe0f04c583eef845e6c34bb24371
-Head: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+Previous: ee39d66be202d9ee2ee5ae49736ecec2b42eb977
+Head: 5e09aee6ce989d4091a0154b0006836a5d1fcb6c
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+ malloc-probe-arena-changes.patch: f79131a099b3fef615615804abf464d52153db7f
+ malloc-probe-retries.patch: 786c63d90602f2bd465555f2c0109f139b0ba787
+ malloc-probe-arena-retry.patch: 22ba7a6b6aa9fc1ef9c21062408e2b44e34cfd44
+ malloc-probe-heaps.patch: 5e09aee6ce989d4091a0154b0006836a5d1fcb6c
Unapplied:
- malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
- malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
- malloc-probe-arena-retry.patch: 1127e966ffcd209c226edafabcc6205196a39bbf
- malloc-probe-heaps.patch: 93544c43ed8844bc091567e533e9bf90fb13ffac
Hidden:
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index d522044..6e2ede2 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,5 +1,5 @@
-Bottom: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
-Top: d8ee598733a1c866c0553f0a24eb661a9a95fdf5
+Bottom: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
+Top: 7d4466858c949b771404c4051d361be6427430ab
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -60,7 +60,7 @@ index 0822fc8..89e8b92 100644
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 45e5208..6545ef8 100644
+index 4c40c2f..4620008 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
index c72c3d5..2ef8acd 100644
--- a/patches/malloc-probe-arena-retry.patch
+++ b/patches/malloc-probe-arena-retry.patch
@@ -1,5 +1,5 @@
-Bottom: ce8902c03b213997a422961f9fe487b01776e275
-Top: b33cfc17d4a4e6d16693175efb1b282ed168c140
+Bottom: 83f39aaa860dd9e5752c433695edaf162707353c
+Top: 9775cea7f0e5808031a4fdc521d11ba34cc84601
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:32 -0300
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
index 31bb126..9b955a9 100644
--- a/patches/malloc-probe-heaps.patch
+++ b/patches/malloc-probe-heaps.patch
@@ -1,5 +1,5 @@
-Bottom: b33cfc17d4a4e6d16693175efb1b282ed168c140
-Top: 0c6455546edd1f52575018aa67ff92bbbabb71df
+Bottom: 9775cea7f0e5808031a4fdc521d11ba34cc84601
+Top: 1fb542e2d47d22d0c29d644f87c54a8daa2be5e7
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:32 -0300
@@ -55,7 +55,7 @@ index 9ace186..d81ed0d 100644
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 0d59a1f..67a16a2 100644
+index 02bff7e..a1ed3b1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
index b333a4f..4dc46de 100644
--- a/patches/malloc-probe-retries.patch
+++ b/patches/malloc-probe-retries.patch
@@ -1,5 +1,5 @@
-Bottom: d8ee598733a1c866c0553f0a24eb661a9a95fdf5
-Top: ce8902c03b213997a422961f9fe487b01776e275
+Bottom: 7d4466858c949b771404c4051d361be6427430ab
+Top: 83f39aaa860dd9e5752c433695edaf162707353c
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -19,7 +19,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 6545ef8..0d59a1f 100644
+index 4620008..02bff7e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ee39d66be202d9ee2ee5ae49736ecec2b42eb977
commit ee39d66be202d9ee2ee5ae49736ecec2b42eb977
Merge: 62596c6 3aa08e8 12d7e8c
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:40 2013 -0300
refresh
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=62596c6c385e89c5cbffd580f33a64895d1f738b
commit 62596c6c385e89c5cbffd580f33a64895d1f738b
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:40 2013 -0300
refresh
diff --git a/meta b/meta
index 627d2b0..179ffda 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,9 @@
Version: 1
-Previous: 268c39c8a235a966f77a6df613e4af53d0e5f060
-Head: 1d26bee2aae9c568f47e4e05472bb410f931a072
+Previous: 3aa08e8edbddbe0f04c583eef845e6c34bb24371
+Head: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
- mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
- refresh-temp: 1d26bee2aae9c568f47e4e05472bb410f931a072
+ mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
Unapplied:
malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
index 627aee6..74fb537 100644
--- a/patches/mallopt-detailed-probes.patch
+++ b/patches/mallopt-detailed-probes.patch
@@ -1,5 +1,5 @@
Bottom: 8f155b7ea739aa01d55a9208e2cd45c9ccbacea0
-Top: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
+Top: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -16,7 +16,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index d256a9b..45e5208 100644
+index d256a9b..4c40c2f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
@@ -38,7 +38,7 @@ index d256a9b..45e5208 100644
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
-+ set_max_fast (value);
++ set_max_fast(value);
+ }
else
res = 0;
diff --git a/patches/refresh-temp b/patches/refresh-temp
deleted file mode 100644
index 7539b6c..0000000
--- a/patches/refresh-temp
+++ /dev/null
@@ -1,22 +0,0 @@
-Bottom: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
-Top: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
-Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-08-13 15:46:39 -0300
-
-Refresh of mallopt-detailed-probes.patch
-
----
-
-diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 45e5208..4c40c2f 100644
---- a/malloc/malloc.c
-+++ b/malloc/malloc.c
-@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
- if (value >= 0 && value <= MAX_FAST_SIZE)
- {
- LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
-- set_max_fast (value);
-+ set_max_fast(value);
- }
- else
- res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3aa08e8edbddbe0f04c583eef845e6c34bb24371
commit 3aa08e8edbddbe0f04c583eef845e6c34bb24371
Merge: ca1979e 268c39c 1d26bee
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:40 2013 -0300
refresh (create temporary patch)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ca1979e4829fbfd3c87e1df6d7181d2e542a8b40
commit ca1979e4829fbfd3c87e1df6d7181d2e542a8b40
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:40 2013 -0300
refresh (create temporary patch)
diff --git a/meta b/meta
index 5e6e64a..627d2b0 100644
--- a/meta
+++ b/meta
@@ -1,9 +1,10 @@
Version: 1
-Previous: 10b112842e2c6788350244495fd21aa150f05ed1
-Head: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
+Previous: 268c39c8a235a966f77a6df613e4af53d0e5f060
+Head: 1d26bee2aae9c568f47e4e05472bb410f931a072
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
+ refresh-temp: 1d26bee2aae9c568f47e4e05472bb410f931a072
Unapplied:
malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
diff --git a/patches/refresh-temp b/patches/refresh-temp
new file mode 100644
index 0000000..7539b6c
--- /dev/null
+++ b/patches/refresh-temp
@@ -0,0 +1,22 @@
+Bottom: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
+Top: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2013-08-13 15:46:39 -0300
+
+Refresh of mallopt-detailed-probes.patch
+
+---
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 45e5208..4c40c2f 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+- set_max_fast (value);
++ set_max_fast(value);
+ }
+ else
+ res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1d26bee2aae9c568f47e4e05472bb410f931a072
commit 1d26bee2aae9c568f47e4e05472bb410f931a072
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:46:39 2013 -0300
Refresh of mallopt-detailed-probes.patch
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 45e5208..4c40c2f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
if (value >= 0 && value <= MAX_FAST_SIZE)
{
LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
- set_max_fast (value);
+ set_max_fast(value);
}
else
res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=268c39c8a235a966f77a6df613e4af53d0e5f060
commit 268c39c8a235a966f77a6df613e4af53d0e5f060
Merge: ed312fb 10b1128
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:45:25 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ed312fb21ef4083a74aac1640e337174fd4e5bf5
commit ed312fb21ef4083a74aac1640e337174fd4e5bf5
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:45:25 2013 -0300
push
diff --git a/meta b/meta
index 10953f5..5e6e64a 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,10 @@
Version: 1
-Previous: ff84a1e9ffdf923e80a19c25e0a0d279718e1ec0
-Head: ca0a6bc4c5c53aa6c4a735c36336408a06b8cd89
+Previous: 10b112842e2c6788350244495fd21aa150f05ed1
+Head: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
Applied:
-Unapplied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
+Unapplied:
malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
malloc-probe-arena-retry.patch: 1127e966ffcd209c226edafabcc6205196a39bbf
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=10b112842e2c6788350244495fd21aa150f05ed1
commit 10b112842e2c6788350244495fd21aa150f05ed1
Merge: 8539cb8 ff84a1e ca0a6bc
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:45:23 2013 -0300
pop
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8539cb81c12a91c6c564bb4b7562d534c62d634e
commit 8539cb81c12a91c6c564bb4b7562d534c62d634e
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:45:23 2013 -0300
pop
diff --git a/meta b/meta
index 755ebb9..10953f5 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 672f9d8a307d575445cdcea9900926b79649f601
-Head: 93544c43ed8844bc091567e533e9bf90fb13ffac
+Previous: ff84a1e9ffdf923e80a19c25e0a0d279718e1ec0
+Head: ca0a6bc4c5c53aa6c4a735c36336408a06b8cd89
Applied:
+Unapplied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
malloc-probe-arena-retry.patch: 1127e966ffcd209c226edafabcc6205196a39bbf
malloc-probe-heaps.patch: 93544c43ed8844bc091567e533e9bf90fb13ffac
-Unapplied:
Hidden:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ff84a1e9ffdf923e80a19c25e0a0d279718e1ec0
commit ff84a1e9ffdf923e80a19c25e0a0d279718e1ec0
Merge: 3e9167a 672f9d8 93544c4
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:15 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3e9167acf921505368e8372158132e1b6a9b5b28
commit 3e9167acf921505368e8372158132e1b6a9b5b28
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:15 2013 -0300
push
diff --git a/meta b/meta
index f57d988..755ebb9 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: a7ffd09a36a5acd1b173a90a3d4f07ef4250ed9f
-Head: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
+Previous: 672f9d8a307d575445cdcea9900926b79649f601
+Head: 93544c43ed8844bc091567e533e9bf90fb13ffac
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
+ malloc-probe-arena-changes.patch: b4278e199f9b2101c8dadadf901fca20bed26087
+ malloc-probe-retries.patch: a934be56da915e1abc0283aae8f4f11323e2d028
+ malloc-probe-arena-retry.patch: 1127e966ffcd209c226edafabcc6205196a39bbf
+ malloc-probe-heaps.patch: 93544c43ed8844bc091567e533e9bf90fb13ffac
Unapplied:
- malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
- malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
- malloc-probe-arena-retry.patch: 56f822b977e00a25c45122f05f650c284c2b5730
- malloc-probe-heaps.patch: 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
Hidden:
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index 6e2ede2..d522044 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,5 +1,5 @@
-Bottom: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
-Top: 7d4466858c949b771404c4051d361be6427430ab
+Bottom: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
+Top: d8ee598733a1c866c0553f0a24eb661a9a95fdf5
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -60,7 +60,7 @@ index 0822fc8..89e8b92 100644
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 4c40c2f..4620008 100644
+index 45e5208..6545ef8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
index 2ef8acd..c72c3d5 100644
--- a/patches/malloc-probe-arena-retry.patch
+++ b/patches/malloc-probe-arena-retry.patch
@@ -1,5 +1,5 @@
-Bottom: 83f39aaa860dd9e5752c433695edaf162707353c
-Top: 9775cea7f0e5808031a4fdc521d11ba34cc84601
+Bottom: ce8902c03b213997a422961f9fe487b01776e275
+Top: b33cfc17d4a4e6d16693175efb1b282ed168c140
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:32 -0300
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
index 9b955a9..31bb126 100644
--- a/patches/malloc-probe-heaps.patch
+++ b/patches/malloc-probe-heaps.patch
@@ -1,5 +1,5 @@
-Bottom: 9775cea7f0e5808031a4fdc521d11ba34cc84601
-Top: 1fb542e2d47d22d0c29d644f87c54a8daa2be5e7
+Bottom: b33cfc17d4a4e6d16693175efb1b282ed168c140
+Top: 0c6455546edd1f52575018aa67ff92bbbabb71df
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:32 -0300
@@ -55,7 +55,7 @@ index 9ace186..d81ed0d 100644
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 02bff7e..a1ed3b1 100644
+index 0d59a1f..67a16a2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
index 4dc46de..b333a4f 100644
--- a/patches/malloc-probe-retries.patch
+++ b/patches/malloc-probe-retries.patch
@@ -1,5 +1,5 @@
-Bottom: 7d4466858c949b771404c4051d361be6427430ab
-Top: 83f39aaa860dd9e5752c433695edaf162707353c
+Bottom: d8ee598733a1c866c0553f0a24eb661a9a95fdf5
+Top: ce8902c03b213997a422961f9fe487b01776e275
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -19,7 +19,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 4620008..02bff7e 100644
+index 6545ef8..0d59a1f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=93544c43ed8844bc091567e533e9bf90fb13ffac
commit 93544c43ed8844bc091567e533e9bf90fb13ffac
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
Add malloc probes for sbrk and heap resizing.
for ChangeLog
* malloc/arena.c (new_heap): New memory_heap_new probe.
(grow_heap): New memory_heap_more probe.
(shrink_heap): New memory_heap_less probe.
(heap_trim): New memory_heap_free probe.
* malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
(systrim): New memory_sbrk_less probe.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186..d81ed0d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0d59a1f..67a16a2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
index 6cf1b91..650bea7 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is shortened by calling
+@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
+(the positive value, rather than the negated number passed to
+@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit before (unlike the other sbrk and heap probes) a heap
+is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
+the heap, and @var{$arg2} is the size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
@deftp Probe memory_malloc_retry (size_t @var{$arg1})
@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1127e966ffcd209c226edafabcc6205196a39bbf
commit 1127e966ffcd209c226edafabcc6205196a39bbf
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
Add catch-all alloc retry probe.
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index 89cbabc..6cf1b91 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a934be56da915e1abc0283aae8f4f11323e2d028
commit a934be56da915e1abc0283aae8f4f11323e2d028
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:31 2013 -0300
Add probes for malloc retries.
for ChangeLog
* malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
(__libc_realloc): Add memory_realloc_retry probe.
(__libc_memalign): Add memory_memalign_retry probe.
(__libc_valloc): Add memory_valloc_retry probe.
(__libc_pvalloc): Add memory_pvalloc_retry probe.
(__libc_calloc): Add memory_calloc_retry probe.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6545ef8..0d59a1f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
index cf8c1b0..89cbabc 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are hit when the corresponding functions fail to obtain the
+requested amount of memory from the arena in use, before it retries on
+another arena. Argument @var{$arg1} is the amount of memory requested
+by the user; in the @code{calloc} case, that is the total size computed
+from both function arguments. In the @code{realloc} case, @var{$arg2}
+is the pointer to the memory area being resized. In the @code{memalign}
+case, @var{$arg2} is the alignment to be used for the request, which may
+be stricter than the value passed to the @code{memalign} function.
+
+Note that the argument order does NOT match that of the corresponding
+two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b4278e199f9b2101c8dadadf901fca20bed26087
commit b4278e199f9b2101c8dadadf901fca20bed26087
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:31 2013 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 45e5208..6545ef8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index a6fad34..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=672f9d8a307d575445cdcea9900926b79649f601
commit 672f9d8a307d575445cdcea9900926b79649f601
Merge: 788c237 a7ffd09 2a3f892
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:13 2013 -0300
refresh
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=788c237ac8a3c3effe1dcbb246152a038b26e735
commit 788c237ac8a3c3effe1dcbb246152a038b26e735
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:13 2013 -0300
refresh
diff --git a/meta b/meta
index b3a7cc2..f57d988 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,9 @@
Version: 1
-Previous: 58f90704cfbf1c35eed442758597927727cdbe2a
-Head: 831d0e207fafd09c824b3218c76e780b0bb1d899
+Previous: a7ffd09a36a5acd1b173a90a3d4f07ef4250ed9f
+Head: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
- mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
- refresh-temp: 831d0e207fafd09c824b3218c76e780b0bb1d899
+ mallopt-detailed-probes.patch: 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
Unapplied:
malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
index 74fb537..627aee6 100644
--- a/patches/mallopt-detailed-probes.patch
+++ b/patches/mallopt-detailed-probes.patch
@@ -1,5 +1,5 @@
Bottom: 8f155b7ea739aa01d55a9208e2cd45c9ccbacea0
-Top: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
+Top: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2013-08-13 15:31:31 -0300
@@ -16,7 +16,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index d256a9b..4c40c2f 100644
+index d256a9b..45e5208 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
@@ -38,7 +38,7 @@ index d256a9b..4c40c2f 100644
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
-+ set_max_fast(value);
++ set_max_fast (value);
+ }
else
res = 0;
diff --git a/patches/refresh-temp b/patches/refresh-temp
deleted file mode 100644
index c8369a3..0000000
--- a/patches/refresh-temp
+++ /dev/null
@@ -1,22 +0,0 @@
-Bottom: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
-Top: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
-Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-08-13 15:39:12 -0300
-
-Refresh of mallopt-detailed-probes.patch
-
----
-
-diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 4c40c2f..45e5208 100644
---- a/malloc/malloc.c
-+++ b/malloc/malloc.c
-@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
- if (value >= 0 && value <= MAX_FAST_SIZE)
- {
- LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
-- set_max_fast(value);
-+ set_max_fast (value);
- }
- else
- res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a7ffd09a36a5acd1b173a90a3d4f07ef4250ed9f
commit a7ffd09a36a5acd1b173a90a3d4f07ef4250ed9f
Merge: f9d8097 58f9070 831d0e2
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:12 2013 -0300
refresh (create temporary patch)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f9d80979bfe8bd612987cdf1b33436a7ba0b96ce
commit f9d80979bfe8bd612987cdf1b33436a7ba0b96ce
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:12 2013 -0300
refresh (create temporary patch)
diff --git a/meta b/meta
index 9af31e5..b3a7cc2 100644
--- a/meta
+++ b/meta
@@ -1,9 +1,10 @@
Version: 1
-Previous: ebecca11959e86ed2f5353004ff914f45b65b194
-Head: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+Previous: 58f90704cfbf1c35eed442758597927727cdbe2a
+Head: 831d0e207fafd09c824b3218c76e780b0bb1d899
Applied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+ refresh-temp: 831d0e207fafd09c824b3218c76e780b0bb1d899
Unapplied:
malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
diff --git a/patches/refresh-temp b/patches/refresh-temp
new file mode 100644
index 0000000..c8369a3
--- /dev/null
+++ b/patches/refresh-temp
@@ -0,0 +1,22 @@
+Bottom: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
+Top: a3ca278d03ae3f1e19083582cffaadc7e2c2dfab
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2013-08-13 15:39:12 -0300
+
+Refresh of mallopt-detailed-probes.patch
+
+---
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 4c40c2f..45e5208 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+- set_max_fast(value);
++ set_max_fast (value);
+ }
+ else
+ res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=831d0e207fafd09c824b3218c76e780b0bb1d899
commit 831d0e207fafd09c824b3218c76e780b0bb1d899
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:39:12 2013 -0300
Refresh of mallopt-detailed-probes.patch
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4c40c2f..45e5208 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4685,7 +4685,7 @@ int __libc_mallopt(int param_number, int value)
if (value >= 0 && value <= MAX_FAST_SIZE)
{
LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
- set_max_fast(value);
+ set_max_fast (value);
}
else
res = 0;
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=58f90704cfbf1c35eed442758597927727cdbe2a
commit 58f90704cfbf1c35eed442758597927727cdbe2a
Merge: baad047 ebecca1
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:37:33 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=baad04719962a4c5104d030fd9b869cfb973cdd3
commit baad04719962a4c5104d030fd9b869cfb973cdd3
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:37:33 2013 -0300
push
diff --git a/meta b/meta
index a1133dc..9af31e5 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,10 @@
Version: 1
-Previous: 0d30c1dc7da544a0b60d721f29c0b8b4b829ab71
-Head: ca0a6bc4c5c53aa6c4a735c36336408a06b8cd89
+Previous: ebecca11959e86ed2f5353004ff914f45b65b194
+Head: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
Applied:
-Unapplied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+Unapplied:
malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
malloc-probe-arena-retry.patch: 56f822b977e00a25c45122f05f650c284c2b5730
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ebecca11959e86ed2f5353004ff914f45b65b194
commit ebecca11959e86ed2f5353004ff914f45b65b194
Merge: 0c96bab 0d30c1d ca0a6bc
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:37:32 2013 -0300
pop
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0c96babe411a455231e84250496250d924133b3f
commit 0c96babe411a455231e84250496250d924133b3f
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:37:32 2013 -0300
pop
diff --git a/meta b/meta
index 61a884e..a1133dc 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: af76c85fa773a4f69e8aab5a26c27e5b4b19324f
-Head: 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
+Previous: 0d30c1dc7da544a0b60d721f29c0b8b4b829ab71
+Head: ca0a6bc4c5c53aa6c4a735c36336408a06b8cd89
Applied:
+Unapplied:
malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
malloc-probe-arena-retry.patch: 56f822b977e00a25c45122f05f650c284c2b5730
malloc-probe-heaps.patch: 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
-Unapplied:
Hidden:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0d30c1dc7da544a0b60d721f29c0b8b4b829ab71
commit 0d30c1dc7da544a0b60d721f29c0b8b4b829ab71
Merge: 401f9f8 7fcda4c af76c85
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
pull
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=401f9f89d1464ddc4dbda5bef310c455f1a6ada5
commit 401f9f89d1464ddc4dbda5bef310c455f1a6ada5
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
pull
diff --git a/meta b/meta
index 5fb1c4e..61a884e 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 01a9a0cb4f7cd5248e10877bb0f8126e5121b8b0
-Head: 7f17593d10333d754d4f1b6e25afe18a57272532
+Previous: af76c85fa773a4f69e8aab5a26c27e5b4b19324f
+Head: 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
Applied:
- malloc-probes.patch: 09d77ddd216a591d90ab4196733271023b2200f5
- mallopt-detailed-probes.patch: 0a78899993f72c51a2213dc6193af7c5e333f571
- malloc-probe-arena-changes.patch: 25d8a9b7675bc982c753fd797754b367a26333a2
- malloc-probe-retries.patch: 342eee309a0ee20386b3cbbc936ef53fb7b2bf86
- malloc-probe-arena-retry.patch: 3b07d55a47597d5f6793a85b037cb249caa78f28
- malloc-probe-heaps.patch: 7f17593d10333d754d4f1b6e25afe18a57272532
+ malloc-probes.patch: f598aa665ca0e9cb3efcbad120b6bf97b405ed62
+ mallopt-detailed-probes.patch: 12d7e8c3c58ffe7ee35e91b95f824ef36a6df70b
+ malloc-probe-arena-changes.patch: 13439f7bf39b4a0e105beae3b8da983ebf138f41
+ malloc-probe-retries.patch: d14c57f9dd032cb48de19807e7e114e0119249db
+ malloc-probe-arena-retry.patch: 56f822b977e00a25c45122f05f650c284c2b5730
+ malloc-probe-heaps.patch: 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
Unapplied:
Hidden:
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index aa2e09b..6e2ede2 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,7 +1,7 @@
-Bottom: 644283f06be331a184735c9d0ffc22e97e942448
-Top: 3880bd43cb20c34065d53429ce64139a2fdb4c78
+Bottom: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
+Top: 7d4466858c949b771404c4051d361be6427430ab
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:13 -0300
+Date: 2013-08-13 15:31:31 -0300
Add probes for malloc arena changes.
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
index 50deb21..2ef8acd 100644
--- a/patches/malloc-probe-arena-retry.patch
+++ b/patches/malloc-probe-arena-retry.patch
@@ -1,7 +1,7 @@
-Bottom: 7c5adf7d6edcd0522570314364ae9001f4061f39
-Top: 063cabd1938fb1ea35620c408d2369fbadd9acec
+Bottom: 83f39aaa860dd9e5752c433695edaf162707353c
+Top: 9775cea7f0e5808031a4fdc521d11ba34cc84601
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:14 -0300
+Date: 2013-08-13 15:31:32 -0300
Add catch-all alloc retry probe.
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
index 8818162..9b955a9 100644
--- a/patches/malloc-probe-heaps.patch
+++ b/patches/malloc-probe-heaps.patch
@@ -1,7 +1,7 @@
-Bottom: 063cabd1938fb1ea35620c408d2369fbadd9acec
-Top: 56c37ae963bd6aab8f43bce1d11c90db660600b9
+Bottom: 9775cea7f0e5808031a4fdc521d11ba34cc84601
+Top: 1fb542e2d47d22d0c29d644f87c54a8daa2be5e7
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:14 -0300
+Date: 2013-08-13 15:31:32 -0300
Add malloc probes for sbrk and heap resizing.
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
index f954d6c..4dc46de 100644
--- a/patches/malloc-probe-retries.patch
+++ b/patches/malloc-probe-retries.patch
@@ -1,7 +1,7 @@
-Bottom: 3880bd43cb20c34065d53429ce64139a2fdb4c78
-Top: 7c5adf7d6edcd0522570314364ae9001f4061f39
+Bottom: 7d4466858c949b771404c4051d361be6427430ab
+Top: 83f39aaa860dd9e5752c433695edaf162707353c
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:14 -0300
+Date: 2013-08-13 15:31:31 -0300
Add probes for malloc retries.
diff --git a/patches/malloc-probes.patch b/patches/malloc-probes.patch
index 6184c82..322baaf 100644
--- a/patches/malloc-probes.patch
+++ b/patches/malloc-probes.patch
@@ -1,7 +1,7 @@
-Bottom: efed39b7ade4b9cbc21039a1156412424917f48d
-Top: 91d81adc08ce09255a6ca95e0a6622e456adb4cf
+Bottom: fde38f49e9ff8e251fc3a4c9a8d5f194ba6decbf
+Top: 8f155b7ea739aa01d55a9208e2cd45c9ccbacea0
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:13 -0300
+Date: 2013-08-13 15:31:31 -0300
Add first set of memory probes.
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
index 2a329b2..74fb537 100644
--- a/patches/mallopt-detailed-probes.patch
+++ b/patches/mallopt-detailed-probes.patch
@@ -1,7 +1,7 @@
-Bottom: 91d81adc08ce09255a6ca95e0a6622e456adb4cf
-Top: 644283f06be331a184735c9d0ffc22e97e942448
+Bottom: 8f155b7ea739aa01d55a9208e2cd45c9ccbacea0
+Top: 4c44eaa5aaa7557e873046cfa7c812e97c9e6217
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:35:13 -0300
+Date: 2013-08-13 15:31:31 -0300
Add probes for all changes to malloc options.
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
commit 7fcda4c4e8a3e34ce56b874e9f9108a7a45e2266
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
Add malloc probes for sbrk and heap resizing.
for ChangeLog
* malloc/arena.c (new_heap): New memory_heap_new probe.
(grow_heap): New memory_heap_more probe.
(shrink_heap): New memory_heap_less probe.
(heap_trim): New memory_heap_free probe.
* malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
(systrim): New memory_sbrk_less probe.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186..d81ed0d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 02bff7e..a1ed3b1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
index 6cf1b91..650bea7 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is shortened by calling
+@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
+(the positive value, rather than the negated number passed to
+@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit before (unlike the other sbrk and heap probes) a heap
+is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
+the heap, and @var{$arg2} is the size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
@deftp Probe memory_malloc_retry (size_t @var{$arg1})
@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=56f822b977e00a25c45122f05f650c284c2b5730
commit 56f822b977e00a25c45122f05f650c284c2b5730
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:32 2013 -0300
Add catch-all alloc retry probe.
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index 89cbabc..6cf1b91 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2a3f892306d80c5cb3dcc958f50c96213bfd73e3
commit 2a3f892306d80c5cb3dcc958f50c96213bfd73e3
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:31 2013 -0300
Add probes for all changes to malloc options.
for ChangeLog
* malloc/malloc.c (__libc_free): Add
memory_mallopt_free_dyn_thresholds probe.
(__libc_mallopt): Add multiple memory_mallopt probes.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d256a9b..45e5208 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -4680,19 +4682,25 @@ int __libc_mallopt(int param_number, int value)
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast (value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4703,33 +4711,45 @@ int __libc_mallopt(int param_number, int value)
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
diff --git a/manual/probes.texi b/manual/probes.texi
index 500c243..a6fad34 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
the ones passed to the @code{mallopt} function.
@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MXFAST}, and the requested value is
+in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TOP_PAD}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_THRESHOLD}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustments
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_MAX}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_CHECK_ACTION}. Argument @var{$arg1}
+is the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_PERTURB}. Argument @var{$arg1} is
+the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_TEST}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_MAX}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d14c57f9dd032cb48de19807e7e114e0119249db
commit d14c57f9dd032cb48de19807e7e114e0119249db
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:31 2013 -0300
Add probes for malloc retries.
for ChangeLog
* malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
(__libc_realloc): Add memory_realloc_retry probe.
(__libc_memalign): Add memory_memalign_retry probe.
(__libc_valloc): Add memory_valloc_retry probe.
(__libc_pvalloc): Add memory_pvalloc_retry probe.
(__libc_calloc): Add memory_calloc_retry probe.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4620008..02bff7e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
index cf8c1b0..89cbabc 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are hit when the corresponding functions fail to obtain the
+requested amount of memory from the arena in use, before it retries on
+another arena. Argument @var{$arg1} is the amount of memory requested
+by the user; in the @code{calloc} case, that is the total size computed
+from both function arguments. In the @code{realloc} case, @var{$arg2}
+is the pointer to the memory area being resized. In the @code{memalign}
+case, @var{$arg2} is the alignment to be used for the request, which may
+be stricter than the value passed to the @code{memalign} function.
+
+Note that the argument order does NOT match that of the corresponding
+two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=13439f7bf39b4a0e105beae3b8da983ebf138f41
commit 13439f7bf39b4a0e105beae3b8da983ebf138f41
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Aug 13 15:31:31 2013 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4c40c2f..4620008 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index a6fad34..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=af76c85fa773a4f69e8aab5a26c27e5b4b19324f
commit af76c85fa773a4f69e8aab5a26c27e5b4b19324f
Merge: 9b13ea4 01a9a0c 7f17593
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:15 2013 -0300
pull
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9b13ea4932fa030ed178e68b847def2a43357877
commit 9b13ea4932fa030ed178e68b847def2a43357877
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:15 2013 -0300
pull
diff --git a/meta b/meta
index f7debde..5fb1c4e 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 252b84ae27c16806cc2fc4f6f702afc04a4678fa
-Head: 263e4242db5c5574ec22198cee3f1c4918b9a7f3
+Previous: 01a9a0cb4f7cd5248e10877bb0f8126e5121b8b0
+Head: 7f17593d10333d754d4f1b6e25afe18a57272532
Applied:
- malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
- mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
- malloc-probe-arena-changes.patch: 6873f4491ded8066c3bcd1ade939cf8591f48303
- malloc-probe-retries.patch: 634ccc438d1aa9fde07c62a9e8c6f95f201d2632
- malloc-probe-arena-retry.patch: beea7ae8508dfcda05e0e393e1c1b10c30daa53b
- malloc-probe-heaps.patch: 263e4242db5c5574ec22198cee3f1c4918b9a7f3
+ malloc-probes.patch: 09d77ddd216a591d90ab4196733271023b2200f5
+ mallopt-detailed-probes.patch: 0a78899993f72c51a2213dc6193af7c5e333f571
+ malloc-probe-arena-changes.patch: 25d8a9b7675bc982c753fd797754b367a26333a2
+ malloc-probe-retries.patch: 342eee309a0ee20386b3cbbc936ef53fb7b2bf86
+ malloc-probe-arena-retry.patch: 3b07d55a47597d5f6793a85b037cb249caa78f28
+ malloc-probe-heaps.patch: 7f17593d10333d754d4f1b6e25afe18a57272532
Unapplied:
Hidden:
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index 4681972..aa2e09b 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,7 +1,7 @@
-Bottom: d4ac695d79ac61ccd9bd4ae034dc7d04b2e6c00e
-Top: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
+Bottom: 644283f06be331a184735c9d0ffc22e97e942448
+Top: 3880bd43cb20c34065d53429ce64139a2fdb4c78
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:20 -0300
+Date: 2013-07-30 04:35:13 -0300
Add probes for malloc arena changes.
@@ -60,7 +60,7 @@ index 0822fc8..89e8b92 100644
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 5e23de2..46a1454 100644
+index 4c40c2f..4620008 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
index 6e6cc3c..50deb21 100644
--- a/patches/malloc-probe-arena-retry.patch
+++ b/patches/malloc-probe-arena-retry.patch
@@ -1,7 +1,7 @@
-Bottom: 813ff2cf41ede6564fca640260dfa9ea798d3665
-Top: 1e3f5f07deb86b114d89d42181bd7cb0240cd463
+Bottom: 7c5adf7d6edcd0522570314364ae9001f4061f39
+Top: 063cabd1938fb1ea35620c408d2369fbadd9acec
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:21 -0300
+Date: 2013-07-30 04:35:14 -0300
Add catch-all alloc retry probe.
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
index ce805d0..8818162 100644
--- a/patches/malloc-probe-heaps.patch
+++ b/patches/malloc-probe-heaps.patch
@@ -1,7 +1,7 @@
-Bottom: 1e3f5f07deb86b114d89d42181bd7cb0240cd463
-Top: 1a85a998f0168167763d4e1f62b9bc1f73a1634c
+Bottom: 063cabd1938fb1ea35620c408d2369fbadd9acec
+Top: 56c37ae963bd6aab8f43bce1d11c90db660600b9
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:21 -0300
+Date: 2013-07-30 04:35:14 -0300
Add malloc probes for sbrk and heap resizing.
@@ -55,7 +55,7 @@ index 9ace186..d81ed0d 100644
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 54cdef8..b2684c6 100644
+index 02bff7e..a1ed3b1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
index 5cdcc9a..f954d6c 100644
--- a/patches/malloc-probe-retries.patch
+++ b/patches/malloc-probe-retries.patch
@@ -1,7 +1,7 @@
-Bottom: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
-Top: 813ff2cf41ede6564fca640260dfa9ea798d3665
+Bottom: 3880bd43cb20c34065d53429ce64139a2fdb4c78
+Top: 7c5adf7d6edcd0522570314364ae9001f4061f39
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:20 -0300
+Date: 2013-07-30 04:35:14 -0300
Add probes for malloc retries.
@@ -19,7 +19,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 46a1454..54cdef8 100644
+index 4620008..02bff7e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
diff --git a/patches/malloc-probes.patch b/patches/malloc-probes.patch
index 0e0e764..6184c82 100644
--- a/patches/malloc-probes.patch
+++ b/patches/malloc-probes.patch
@@ -1,7 +1,7 @@
-Bottom: 0a6de6636226d8398fba9c6b85e3ca5ec69a7ec4
-Top: db702c9315c73e17dec3f422731866c77dfa1f48
+Bottom: efed39b7ade4b9cbc21039a1156412424917f48d
+Top: 91d81adc08ce09255a6ca95e0a6622e456adb4cf
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:18 -0300
+Date: 2013-07-30 04:35:13 -0300
Add first set of memory probes.
@@ -30,7 +30,7 @@ index 12a48ad..0822fc8 100644
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index 70b9329..b68061b 100644
+index be472b2..d256a9b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1878,6 +1878,8 @@ static int perturb_byte;
@@ -112,7 +112,7 @@ index 0000000..500c2432
+the ones passed to the @code{mallopt} function.
+@end deftp
diff --git a/manual/threads.texi b/manual/threads.texi
-index 9a1df1a..79a82c7 100644
+index a23ac26..6b7523c 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -1,5 +1,5 @@
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
index 3d04d2c..2a329b2 100644
--- a/patches/mallopt-detailed-probes.patch
+++ b/patches/mallopt-detailed-probes.patch
@@ -1,7 +1,7 @@
-Bottom: db702c9315c73e17dec3f422731866c77dfa1f48
-Top: d4ac695d79ac61ccd9bd4ae034dc7d04b2e6c00e
+Bottom: 91d81adc08ce09255a6ca95e0a6622e456adb4cf
+Top: 644283f06be331a184735c9d0ffc22e97e942448
Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2012-10-10 08:46:20 -0300
+Date: 2013-07-30 04:35:13 -0300
Add probes for all changes to malloc options.
@@ -16,7 +16,7 @@ for ChangeLog
---
diff --git a/malloc/malloc.c b/malloc/malloc.c
-index b68061b..5e23de2 100644
+index d256a9b..4c40c2f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7f17593d10333d754d4f1b6e25afe18a57272532
commit 7f17593d10333d754d4f1b6e25afe18a57272532
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:14 2013 -0300
Add malloc probes for sbrk and heap resizing.
for ChangeLog
* malloc/arena.c (new_heap): New memory_heap_new probe.
(grow_heap): New memory_heap_more probe.
(shrink_heap): New memory_heap_less probe.
(heap_trim): New memory_heap_free probe.
* malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
(systrim): New memory_sbrk_less probe.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186..d81ed0d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 02bff7e..a1ed3b1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
index 6cf1b91..650bea7 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is shortened by calling
+@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
+(the positive value, rather than the negated number passed to
+@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit before (unlike the other sbrk and heap probes) a heap
+is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
+the heap, and @var{$arg2} is the size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
@deftp Probe memory_malloc_retry (size_t @var{$arg1})
@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3b07d55a47597d5f6793a85b037cb249caa78f28
commit 3b07d55a47597d5f6793a85b037cb249caa78f28
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:14 2013 -0300
Add catch-all alloc retry probe.
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index 89cbabc..6cf1b91 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=342eee309a0ee20386b3cbbc936ef53fb7b2bf86
commit 342eee309a0ee20386b3cbbc936ef53fb7b2bf86
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:14 2013 -0300
Add probes for malloc retries.
for ChangeLog
* malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
(__libc_realloc): Add memory_realloc_retry probe.
(__libc_memalign): Add memory_memalign_retry probe.
(__libc_valloc): Add memory_valloc_retry probe.
(__libc_pvalloc): Add memory_pvalloc_retry probe.
(__libc_calloc): Add memory_calloc_retry probe.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4620008..02bff7e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
index cf8c1b0..89cbabc 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are hit when the corresponding functions fail to obtain the
+requested amount of memory from the arena in use, before it retries on
+another arena. Argument @var{$arg1} is the amount of memory requested
+by the user; in the @code{calloc} case, that is the total size computed
+from both function arguments. In the @code{realloc} case, @var{$arg2}
+is the pointer to the memory area being resized. In the @code{memalign}
+case, @var{$arg2} is the alignment to be used for the request, which may
+be stricter than the value passed to the @code{memalign} function.
+
+Note that the argument order does NOT match that of the corresponding
+two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=25d8a9b7675bc982c753fd797754b367a26333a2
commit 25d8a9b7675bc982c753fd797754b367a26333a2
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:13 2013 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 4c40c2f..4620008 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index a6fad34..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0a78899993f72c51a2213dc6193af7c5e333f571
commit 0a78899993f72c51a2213dc6193af7c5e333f571
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:13 2013 -0300
Add probes for all changes to malloc options.
for ChangeLog
* malloc/malloc.c (__libc_free): Add
memory_mallopt_free_dyn_thresholds probe.
(__libc_mallopt): Add multiple memory_mallopt probes.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d256a9b..4c40c2f 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -4680,19 +4682,25 @@ int __libc_mallopt(int param_number, int value)
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast(value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4703,33 +4711,45 @@ int __libc_mallopt(int param_number, int value)
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
diff --git a/manual/probes.texi b/manual/probes.texi
index 500c243..a6fad34 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
the ones passed to the @code{mallopt} function.
@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MXFAST}, and the requested value is
+in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TOP_PAD}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_THRESHOLD}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustments
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_MAX}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_CHECK_ACTION}. Argument @var{$arg1}
+is the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_PERTURB}. Argument @var{$arg1} is
+the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_TEST}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_MAX}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=09d77ddd216a591d90ab4196733271023b2200f5
commit 09d77ddd216a591d90ab4196733271023b2200f5
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:35:13 2013 -0300
Add first set of memory probes.
for ChangeLog
* malloc/malloc.c: Include stap-probe.h.
(__libc_mallopt): Add memory_mallopt probe.
* malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
* manual/probes.texi: New.
* manual/Makefile (chapters): Add probes.
* manual/threads.texi: Set next node.
diff --git a/malloc/arena.c b/malloc/arena.c
index 12a48ad..0822fc8 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -736,6 +736,7 @@ _int_new_arena(size_t size)
top(a) = (mchunkptr)ptr;
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+ LIBC_PROBE (memory_arena_new, 2, a, size);
tsd_setspecific(arena_key, (void *)a);
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index be472b2..d256a9b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1878,6 +1878,8 @@ static int perturb_byte;
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+#include <stap-probe.h>
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -4674,6 +4676,8 @@ int __libc_mallopt(int param_number, int value)
/* Ensure initialization/consolidation */
malloc_consolidate(av);
+ LIBC_PROBE (memory_mallopt, 2, param_number, value);
+
switch(param_number) {
case M_MXFAST:
if (value >= 0 && value <= MAX_FAST_SIZE) {
diff --git a/manual/Makefile b/manual/Makefile
index 44c0fd4..7bb419a 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug threads)
+ users sysinfo conf crypt debug threads probes)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
diff --git a/manual/probes.texi b/manual/probes.texi
new file mode 100644
index 0000000..500c243
--- /dev/null
+++ b/manual/probes.texi
@@ -0,0 +1,41 @@
+@node Internal Probes
+@c @node Internal Probes, , POSIX Threads, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
+In order to aid in debugging and monitoring @glibcadj{} internal
+behavior, @theglibc{} exposes nearly-zero-overhead probes as Systemtap
+process marks with the @code{libc} provider.
+
+These probes are not part of the @glibcadj{} stable ABI, and they are
+subject to change or removal across releases. Our only promise with
+regard to them is that, if we find a need to remove or modify the
+arguments of a probe, the modified probe will have a different name, so
+that program monitors relying on the old probe will not get unexpected
+arguments.
+
+@menu
+* Memory Allocation Probes:: Probes in the memory allocation subsystem
+@end menu
+
+@node Memory Allocation Probes
+@section Memory Allocation Probes
+
+These probes are designed to signal relatively unusual situations within
+the virtual memory subsystem of @theglibc{}.
+
+@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit when @code{malloc} allocated and initialized an
+additional allocation arena (not the main arena), but before it is
+assigned to the running thread and inserted in the internal linked list
+of arenas. The arena's @code{malloc_state} internal data structure is
+located at @var{$arg1}, within a newly-allocated heap big enough to hold
+at least @var{$arg2} bytes.
+@end deftp
+
+@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{mallopt} is called to change
+@code{malloc} internal configuration parameters, before any change to
+the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+the ones passed to the @code{mallopt} function.
+@end deftp
diff --git a/manual/threads.texi b/manual/threads.texi
index a23ac26..6b7523c 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -1,5 +1,5 @@
@node POSIX Threads
-@c @node POSIX Threads, , Cryptographic Functions, Top
+@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
@chapter POSIX Threads
@c %MENU% POSIX Threads
@cindex pthreads
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=01a9a0cb4f7cd5248e10877bb0f8126e5121b8b0
commit 01a9a0cb4f7cd5248e10877bb0f8126e5121b8b0
Merge: 3c213a4 252b84a 263e424
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:34:05 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3c213a4a3a42c39ce85f3fafa625a1578154b3fb
commit 3c213a4a3a42c39ce85f3fafa625a1578154b3fb
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:34:05 2013 -0300
push
diff --git a/meta b/meta
index 9135975..f7debde 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: c3e23064428b3e18c3ebe382c536d8fb742c501d
-Head: 6873f4491ded8066c3bcd1ade939cf8591f48303
+Previous: 252b84ae27c16806cc2fc4f6f702afc04a4678fa
+Head: 263e4242db5c5574ec22198cee3f1c4918b9a7f3
Applied:
malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
malloc-probe-arena-changes.patch: 6873f4491ded8066c3bcd1ade939cf8591f48303
+ malloc-probe-retries.patch: 634ccc438d1aa9fde07c62a9e8c6f95f201d2632
+ malloc-probe-arena-retry.patch: beea7ae8508dfcda05e0e393e1c1b10c30daa53b
+ malloc-probe-heaps.patch: 263e4242db5c5574ec22198cee3f1c4918b9a7f3
Unapplied:
- malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
- malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
- malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
Hidden:
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
index fe7b520..6e6cc3c 100644
--- a/patches/malloc-probe-arena-retry.patch
+++ b/patches/malloc-probe-arena-retry.patch
@@ -1,5 +1,5 @@
-Bottom: 98e970f78f5aaaa7568c1385ff494bfd3abe36a2
-Top: 9d4d6eaa4eb7480ef2542795e29ccad9cb9c63e5
+Bottom: 813ff2cf41ede6564fca640260dfa9ea798d3665
+Top: 1e3f5f07deb86b114d89d42181bd7cb0240cd463
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:21 -0300
@@ -26,7 +26,7 @@ index 89e8b92..9ace186 100644
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
-index ba30c0d..c5c2870 100644
+index 89cbabc..6cf1b91 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
index e8ef0a8..ce805d0 100644
--- a/patches/malloc-probe-heaps.patch
+++ b/patches/malloc-probe-heaps.patch
@@ -1,5 +1,5 @@
-Bottom: 9d4d6eaa4eb7480ef2542795e29ccad9cb9c63e5
-Top: 4f46302d23a22100ef99c3cd62f39c3d6880e526
+Bottom: 1e3f5f07deb86b114d89d42181bd7cb0240cd463
+Top: 1a85a998f0168167763d4e1f62b9bc1f73a1634c
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:21 -0300
@@ -80,7 +80,7 @@ index 54cdef8..b2684c6 100644
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
-index c5c2870..40a241a 100644
+index 6cf1b91..650bea7 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
index 6cf0af2..5cdcc9a 100644
--- a/patches/malloc-probe-retries.patch
+++ b/patches/malloc-probe-retries.patch
@@ -1,5 +1,5 @@
-Bottom: ddb3776a9a203e24617cd4dd791350fe3ae34426
-Top: 98e970f78f5aaaa7568c1385ff494bfd3abe36a2
+Bottom: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
+Top: 813ff2cf41ede6564fca640260dfa9ea798d3665
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:20 -0300
@@ -71,7 +71,7 @@ index 46a1454..54cdef8 100644
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
-index 8e21190..ba30c0d 100644
+index cf8c1b0..89cbabc 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=263e4242db5c5574ec22198cee3f1c4918b9a7f3
commit 263e4242db5c5574ec22198cee3f1c4918b9a7f3
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:21 2012 -0300
Add malloc probes for sbrk and heap resizing.
for ChangeLog
* malloc/arena.c (new_heap): New memory_heap_new probe.
(grow_heap): New memory_heap_more probe.
(shrink_heap): New memory_heap_less probe.
(heap_trim): New memory_heap_free probe.
* malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
(systrim): New memory_sbrk_less probe.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186..d81ed0d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 54cdef8..b2684c6 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
index 6cf1b91..650bea7 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is shortened by calling
+@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
+(the positive value, rather than the negated number passed to
+@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit before (unlike the other sbrk and heap probes) a heap
+is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
+the heap, and @var{$arg2} is the size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
@deftp Probe memory_malloc_retry (size_t @var{$arg1})
@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=beea7ae8508dfcda05e0e393e1c1b10c30daa53b
commit beea7ae8508dfcda05e0e393e1c1b10c30daa53b
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:21 2012 -0300
Add catch-all alloc retry probe.
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index 89cbabc..6cf1b91 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=634ccc438d1aa9fde07c62a9e8c6f95f201d2632
commit 634ccc438d1aa9fde07c62a9e8c6f95f201d2632
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for malloc retries.
for ChangeLog
* malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
(__libc_realloc): Add memory_realloc_retry probe.
(__libc_memalign): Add memory_memalign_retry probe.
(__libc_valloc): Add memory_valloc_retry probe.
(__libc_pvalloc): Add memory_pvalloc_retry probe.
(__libc_calloc): Add memory_calloc_retry probe.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 46a1454..54cdef8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
index cf8c1b0..89cbabc 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are hit when the corresponding functions fail to obtain the
+requested amount of memory from the arena in use, before it retries on
+another arena. Argument @var{$arg1} is the amount of memory requested
+by the user; in the @code{calloc} case, that is the total size computed
+from both function arguments. In the @code{realloc} case, @var{$arg2}
+is the pointer to the memory area being resized. In the @code{memalign}
+case, @var{$arg2} is the alignment to be used for the request, which may
+be stricter than the value passed to the @code{memalign} function.
+
+Note that the argument order does NOT match that of the corresponding
+two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=252b84ae27c16806cc2fc4f6f702afc04a4678fa
commit 252b84ae27c16806cc2fc4f6f702afc04a4678fa
Merge: 2e1067c c3e2306 6873f44
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:33:59 2013 -0300
refresh
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2e1067ca66ad4462e8fcbb9fcb320a0ede58d980
commit 2e1067ca66ad4462e8fcbb9fcb320a0ede58d980
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:33:59 2013 -0300
refresh
diff --git a/meta b/meta
index da459fb..9135975 100644
--- a/meta
+++ b/meta
@@ -1,11 +1,10 @@
Version: 1
-Previous: 55fd85a335a310b231a4e71453b4830a072addc2
-Head: d49a3852b9e3f67015afae681d8a7e20b9fecf00
+Previous: c3e23064428b3e18c3ebe382c536d8fb742c501d
+Head: 6873f4491ded8066c3bcd1ade939cf8591f48303
Applied:
malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
- malloc-probe-arena-changes.patch: ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
- refresh-temp: d49a3852b9e3f67015afae681d8a7e20b9fecf00
+ malloc-probe-arena-changes.patch: 6873f4491ded8066c3bcd1ade939cf8591f48303
Unapplied:
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index be6b103..4681972 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,5 +1,5 @@
Bottom: d4ac695d79ac61ccd9bd4ae034dc7d04b2e6c00e
-Top: 20ad1a1c785d0021895441938df15744552246e1
+Top: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:20 -0300
@@ -72,7 +72,7 @@ index 5e23de2..46a1454 100644
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
-index a6fad34..1a65872 100644
+index a6fad34..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
@@ -83,7 +83,7 @@ index a6fad34..1a65872 100644
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
-+a pointer to the arena previously used by that thread.
++a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
diff --git a/patches/refresh-temp b/patches/refresh-temp
deleted file mode 100644
index 7abe2bd..0000000
--- a/patches/refresh-temp
+++ /dev/null
@@ -1,22 +0,0 @@
-Bottom: 20ad1a1c785d0021895441938df15744552246e1
-Top: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
-Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:33:59 -0300
-
-Refresh of malloc-probe-arena-changes.patch
-
----
-
-diff --git a/manual/probes.texi b/manual/probes.texi
-index 1a65872..cf8c1b0 100644
---- a/manual/probes.texi
-+++ b/manual/probes.texi
-@@ -37,7 +37,7 @@ at least @var{$arg2} bytes.
- This probe is hit when @code{malloc} has just selected an existing arena
- to reuse, and (temporarily) reserved it for exclusive use. Argument
- @var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
--a pointer to the arena previously used by that thread.
-+a pointer to the arena previously used by that thread.
-
- When per-thread arenas are enabled, this occurs within
- @code{reused_arena}, right after the mutex mentioned in probe
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c3e23064428b3e18c3ebe382c536d8fb742c501d
commit c3e23064428b3e18c3ebe382c536d8fb742c501d
Merge: d0f5126 55fd85a d49a385
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:33:59 2013 -0300
refresh (create temporary patch)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d0f51269a54e48c155274ee59eaf4e6bd47a1a26
commit d0f51269a54e48c155274ee59eaf4e6bd47a1a26
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:33:59 2013 -0300
refresh (create temporary patch)
diff --git a/meta b/meta
index 85ae7bb..da459fb 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,11 @@
Version: 1
-Previous: 2d6031cd094b722c9b579ed075b588341f9f22de
-Head: ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
+Previous: 55fd85a335a310b231a4e71453b4830a072addc2
+Head: d49a3852b9e3f67015afae681d8a7e20b9fecf00
Applied:
malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
malloc-probe-arena-changes.patch: ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
+ refresh-temp: d49a3852b9e3f67015afae681d8a7e20b9fecf00
Unapplied:
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
diff --git a/patches/refresh-temp b/patches/refresh-temp
new file mode 100644
index 0000000..7abe2bd
--- /dev/null
+++ b/patches/refresh-temp
@@ -0,0 +1,22 @@
+Bottom: 20ad1a1c785d0021895441938df15744552246e1
+Top: 71b79e23c89f896c1de8dca6eb0567d1c55e7cff
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2013-07-30 04:33:59 -0300
+
+Refresh of malloc-probe-arena-changes.patch
+
+---
+
+diff --git a/manual/probes.texi b/manual/probes.texi
+index 1a65872..cf8c1b0 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -37,7 +37,7 @@ at least @var{$arg2} bytes.
+ This probe is hit when @code{malloc} has just selected an existing arena
+ to reuse, and (temporarily) reserved it for exclusive use. Argument
+ @var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+-a pointer to the arena previously used by that thread.
++a pointer to the arena previously used by that thread.
+
+ When per-thread arenas are enabled, this occurs within
+ @code{reused_arena}, right after the mutex mentioned in probe
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d49a3852b9e3f67015afae681d8a7e20b9fecf00
commit d49a3852b9e3f67015afae681d8a7e20b9fecf00
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:33:59 2013 -0300
Refresh of malloc-probe-arena-changes.patch
diff --git a/manual/probes.texi b/manual/probes.texi
index 1a65872..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -37,7 +37,7 @@ at least @var{$arg2} bytes.
This probe is hit when @code{malloc} has just selected an existing arena
to reuse, and (temporarily) reserved it for exclusive use. Argument
@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
-a pointer to the arena previously used by that thread.
+a pointer to the arena previously used by that thread.
When per-thread arenas are enabled, this occurs within
@code{reused_arena}, right after the mutex mentioned in probe
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=55fd85a335a310b231a4e71453b4830a072addc2
commit 55fd85a335a310b231a4e71453b4830a072addc2
Merge: e3d9010 2d6031c ceebc1a
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:50 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e3d9010f21e4a2e161c19d78ae462c87873b679b
commit e3d9010f21e4a2e161c19d78ae462c87873b679b
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:50 2013 -0300
push
diff --git a/meta b/meta
index dc7b50c..85ae7bb 100644
--- a/meta
+++ b/meta
@@ -1,11 +1,11 @@
Version: 1
-Previous: 2fc82be42d6788c14323eb33487a279cbafba435
-Head: a6ae9c9d53bd0639c38d5c6339d124637ce51742
+Previous: 2d6031cd094b722c9b579ed075b588341f9f22de
+Head: ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
Applied:
malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
+ malloc-probe-arena-changes.patch: ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
Unapplied:
- malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
index 1c7261e..be6b103 100644
--- a/patches/malloc-probe-arena-changes.patch
+++ b/patches/malloc-probe-arena-changes.patch
@@ -1,5 +1,5 @@
-Bottom: 0a849c59373d188b655eb565b331217df9a1c289
-Top: ddb3776a9a203e24617cd4dd791350fe3ae34426
+Bottom: d4ac695d79ac61ccd9bd4ae034dc7d04b2e6c00e
+Top: 20ad1a1c785d0021895441938df15744552246e1
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:20 -0300
@@ -72,7 +72,7 @@ index 5e23de2..46a1454 100644
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
-index 9880eef..8e21190 100644
+index a6fad34..1a65872 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6873f4491ded8066c3bcd1ade939cf8591f48303
commit 6873f4491ded8066c3bcd1ade939cf8591f48303
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5e23de2..46a1454 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index a6fad34..cf8c1b0 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
commit ceebc1a8e1ceacd16e12dc7cba9e0f6613c4a18f
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5e23de2..46a1454 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index a6fad34..1a65872 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2d6031cd094b722c9b579ed075b588341f9f22de
commit 2d6031cd094b722c9b579ed075b588341f9f22de
Merge: df23644 a6ae9c9 2fc82be
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:46 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=df23644f157e8c08dbab9cd7f28bacbbe8a9fcca
commit df23644f157e8c08dbab9cd7f28bacbbe8a9fcca
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:46 2013 -0300
push
diff --git a/meta b/meta
index a6604d4..dc7b50c 100644
--- a/meta
+++ b/meta
@@ -1,10 +1,10 @@
Version: 1
-Previous: f2545eb85f835a044c97f32be06697858564f30a
-Head: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
+Previous: 2fc82be42d6788c14323eb33487a279cbafba435
+Head: a6ae9c9d53bd0639c38d5c6339d124637ce51742
Applied:
malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
+ mallopt-detailed-probes.patch: a6ae9c9d53bd0639c38d5c6339d124637ce51742
Unapplied:
- mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
index d3989bf..3d04d2c 100644
--- a/patches/mallopt-detailed-probes.patch
+++ b/patches/mallopt-detailed-probes.patch
@@ -1,5 +1,5 @@
-Bottom: 4969ad31dede55b8da5ec5768a38f977ec30dced
-Top: 0a849c59373d188b655eb565b331217df9a1c289
+Bottom: db702c9315c73e17dec3f422731866c77dfa1f48
+Top: d4ac695d79ac61ccd9bd4ae034dc7d04b2e6c00e
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:20 -0300
@@ -106,7 +106,7 @@ index b68061b..5e23de2 100644
#endif
}
diff --git a/manual/probes.texi b/manual/probes.texi
-index af07560..9880eef 100644
+index 500c2432..a6fad34 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a6ae9c9d53bd0639c38d5c6339d124637ce51742
commit a6ae9c9d53bd0639c38d5c6339d124637ce51742
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for all changes to malloc options.
for ChangeLog
* malloc/malloc.c (__libc_free): Add
memory_mallopt_free_dyn_thresholds probe.
(__libc_mallopt): Add multiple memory_mallopt probes.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b68061b..5e23de2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -4680,19 +4682,25 @@ int __libc_mallopt(int param_number, int value)
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast(value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4703,33 +4711,45 @@ int __libc_mallopt(int param_number, int value)
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
diff --git a/manual/probes.texi b/manual/probes.texi
index 500c243..a6fad34 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
the ones passed to the @code{mallopt} function.
@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MXFAST}, and the requested value is
+in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TOP_PAD}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_THRESHOLD}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustments
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_MAX}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_CHECK_ACTION}. Argument @var{$arg1}
+is the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_PERTURB}. Argument @var{$arg1} is
+the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_TEST}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_MAX}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2fc82be42d6788c14323eb33487a279cbafba435
commit 2fc82be42d6788c14323eb33487a279cbafba435
Merge: 45479ec 1fc3da0 f2545eb
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:20 2013 -0300
refresh
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=45479ec43b0a20c6d66e3ea2eef8b576d4a23a9f
commit 45479ec43b0a20c6d66e3ea2eef8b576d4a23a9f
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:20 2013 -0300
refresh
diff --git a/meta b/meta
index 5e925b6..a6604d4 100644
--- a/meta
+++ b/meta
@@ -1,9 +1,8 @@
Version: 1
-Previous: afbbbed71437324bc19489ab4c5d60b8f690411c
-Head: 1c127c3c677b9d07104d40c4cf56f6219a5d923d
+Previous: f2545eb85f835a044c97f32be06697858564f30a
+Head: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
Applied:
- malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
- refresh-temp: 1c127c3c677b9d07104d40c4cf56f6219a5d923d
+ malloc-probes.patch: 1fc3da00698e9bd1d512648d59e288b7125b0c7a
Unapplied:
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
diff --git a/patches/malloc-probes.patch b/patches/malloc-probes.patch
index 999b581..0e0e764 100644
--- a/patches/malloc-probes.patch
+++ b/patches/malloc-probes.patch
@@ -1,5 +1,5 @@
Bottom: 0a6de6636226d8398fba9c6b85e3ca5ec69a7ec4
-Top: 4969ad31dede55b8da5ec5768a38f977ec30dced
+Top: db702c9315c73e17dec3f422731866c77dfa1f48
Author: Alexandre Oliva <aoliva@redhat.com>
Date: 2012-10-10 08:46:18 -0300
@@ -66,12 +66,12 @@ index 44c0fd4..7bb419a 100644
contrib.texi
diff --git a/manual/probes.texi b/manual/probes.texi
new file mode 100644
-index 0000000..af07560
+index 0000000..500c2432
--- /dev/null
+++ b/manual/probes.texi
@@ -0,0 +1,41 @@
+@node Internal Probes
-+@c @node Internal Probes, , Debugging Support, Top
++@c @node Internal Probes, , POSIX Threads, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
diff --git a/patches/refresh-temp b/patches/refresh-temp
deleted file mode 100644
index f52efd4..0000000
--- a/patches/refresh-temp
+++ /dev/null
@@ -1,19 +0,0 @@
-Bottom: 4969ad31dede55b8da5ec5768a38f977ec30dced
-Top: db702c9315c73e17dec3f422731866c77dfa1f48
-Author: Alexandre Oliva <aoliva@redhat.com>
-Date: 2013-07-30 04:32:16 -0300
-
-Refresh of malloc-probes.patch
-
----
-
-diff --git a/manual/probes.texi b/manual/probes.texi
-index af07560..500c2432 100644
---- a/manual/probes.texi
-+++ b/manual/probes.texi
-@@ -1,5 +1,5 @@
- @node Internal Probes
--@c @node Internal Probes, , Debugging Support, Top
-+@c @node Internal Probes, , POSIX Threads, Top
- @c %MENU% Probes to monitor libc internal behavior
- @chapter Internal probes
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=f2545eb85f835a044c97f32be06697858564f30a
commit f2545eb85f835a044c97f32be06697858564f30a
Merge: 5b06c74 1c127c3 afbbbed
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:19 2013 -0300
refresh (create temporary patch)
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5b06c74507525f2a1c755834089544edf76cf348
commit 5b06c74507525f2a1c755834089544edf76cf348
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:19 2013 -0300
refresh (create temporary patch)
diff --git a/meta b/meta
index 0be5658..5e925b6 100644
--- a/meta
+++ b/meta
@@ -1,8 +1,9 @@
Version: 1
-Previous: a12467b77f9c24e44f46441d753ae45c47845b53
-Head: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+Previous: afbbbed71437324bc19489ab4c5d60b8f690411c
+Head: 1c127c3c677b9d07104d40c4cf56f6219a5d923d
Applied:
malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+ refresh-temp: 1c127c3c677b9d07104d40c4cf56f6219a5d923d
Unapplied:
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
diff --git a/patches/refresh-temp b/patches/refresh-temp
new file mode 100644
index 0000000..f52efd4
--- /dev/null
+++ b/patches/refresh-temp
@@ -0,0 +1,19 @@
+Bottom: 4969ad31dede55b8da5ec5768a38f977ec30dced
+Top: db702c9315c73e17dec3f422731866c77dfa1f48
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2013-07-30 04:32:16 -0300
+
+Refresh of malloc-probes.patch
+
+---
+
+diff --git a/manual/probes.texi b/manual/probes.texi
+index af07560..500c2432 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -1,5 +1,5 @@
+ @node Internal Probes
+-@c @node Internal Probes, , Debugging Support, Top
++@c @node Internal Probes, , POSIX Threads, Top
+ @c %MENU% Probes to monitor libc internal behavior
+ @chapter Internal probes
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1c127c3c677b9d07104d40c4cf56f6219a5d923d
commit 1c127c3c677b9d07104d40c4cf56f6219a5d923d
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:32:16 2013 -0300
Refresh of malloc-probes.patch
diff --git a/manual/probes.texi b/manual/probes.texi
index af07560..500c243 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -1,5 +1,5 @@
@node Internal Probes
-@c @node Internal Probes, , Debugging Support, Top
+@c @node Internal Probes, , POSIX Threads, Top
@c %MENU% Probes to monitor libc internal behavior
@chapter Internal probes
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=afbbbed71437324bc19489ab4c5d60b8f690411c
commit afbbbed71437324bc19489ab4c5d60b8f690411c
Merge: 77efec9 a12467b
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:29:26 2013 -0300
pop
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=77efec96e19c806ee5ffe26860e4d96abca396ca
commit 77efec96e19c806ee5ffe26860e4d96abca396ca
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:29:26 2013 -0300
pop
diff --git a/meta b/meta
index 4341922..0be5658 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 3d5e8306555b548188599928f66fb8bec670feff
-Head: 6de33e11b341b140835f87c20ba88dd06c05f6d9
+Previous: a12467b77f9c24e44f46441d753ae45c47845b53
+Head: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
Applied:
malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+Unapplied:
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
-Unapplied:
Hidden:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a12467b77f9c24e44f46441d753ae45c47845b53
commit a12467b77f9c24e44f46441d753ae45c47845b53
Merge: aef1f8a 3d5e830
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:48 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=aef1f8a07ac09a95ffacd8ce4e06d7f36c039e40
commit aef1f8a07ac09a95ffacd8ce4e06d7f36c039e40
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:47 2013 -0300
push
diff --git a/meta b/meta
index d14dcd9..4341922 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: 902b933e3e229c94616253405949f813ac91f73c
-Head: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+Previous: 3d5e8306555b548188599928f66fb8bec670feff
+Head: 6de33e11b341b140835f87c20ba88dd06c05f6d9
Applied:
malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
-Unapplied:
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
+Unapplied:
Hidden:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3d5e8306555b548188599928f66fb8bec670feff
commit 3d5e8306555b548188599928f66fb8bec670feff
Merge: b903e47 902b933
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:42 2013 -0300
push
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b903e471bfdd63c54195f5ae88e3034937d66787
commit b903e471bfdd63c54195f5ae88e3034937d66787
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:42 2013 -0300
push
diff --git a/meta b/meta
index 59fdcf8..d14dcd9 100644
--- a/meta
+++ b/meta
@@ -1,9 +1,9 @@
Version: 1
-Previous: d98a26634505e04d3c9f70188eefd880c279d1fd
-Head: 9dc9095d565db04da8474b15f646f6bfb84a8395
+Previous: 902b933e3e229c94616253405949f813ac91f73c
+Head: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
Applied:
-Unapplied:
malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+Unapplied:
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=902b933e3e229c94616253405949f813ac91f73c
commit 902b933e3e229c94616253405949f813ac91f73c
Merge: 68f4720 d98a266 9dc9095
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:28 2013 -0300
pop
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=68f472086ec382c4c27b80a7302453754a0a682b
commit 68f472086ec382c4c27b80a7302453754a0a682b
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:28 2013 -0300
pop
diff --git a/meta b/meta
index 0b5440f..59fdcf8 100644
--- a/meta
+++ b/meta
@@ -1,12 +1,12 @@
Version: 1
-Previous: None
-Head: 6de33e11b341b140835f87c20ba88dd06c05f6d9
+Previous: d98a26634505e04d3c9f70188eefd880c279d1fd
+Head: 9dc9095d565db04da8474b15f646f6bfb84a8395
Applied:
+Unapplied:
malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
-Unapplied:
Hidden:
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d98a26634505e04d3c9f70188eefd880c279d1fd
commit d98a26634505e04d3c9f70188eefd880c279d1fd
Merge: 86230b5 6de33e1
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:26 2013 -0300
start of log
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=86230b526914e92200f8d8dba52daf24f4b39a44
commit 86230b526914e92200f8d8dba52daf24f4b39a44
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Tue Jul 30 04:26:26 2013 -0300
start of log
diff --git a/meta b/meta
new file mode 100644
index 0000000..0b5440f
--- /dev/null
+++ b/meta
@@ -0,0 +1,12 @@
+Version: 1
+Previous: None
+Head: 6de33e11b341b140835f87c20ba88dd06c05f6d9
+Applied:
+ malloc-probes.patch: 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
+ mallopt-detailed-probes.patch: bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
+ malloc-probe-arena-changes.patch: d4a518f876bf6280ec844094aa3184c31834dd50
+ malloc-probe-retries.patch: ecd1ec40a0471b94913289731442f326e4d20ad2
+ malloc-probe-arena-retry.patch: 1e514fab25b81088e2b4eba2acf0bdb85421a536
+ malloc-probe-heaps.patch: 6de33e11b341b140835f87c20ba88dd06c05f6d9
+Unapplied:
+Hidden:
diff --git a/patches/malloc-probe-arena-changes.patch b/patches/malloc-probe-arena-changes.patch
new file mode 100644
index 0000000..1c7261e
--- /dev/null
+++ b/patches/malloc-probe-arena-changes.patch
@@ -0,0 +1,144 @@
+Bottom: 0a849c59373d188b655eb565b331217df9a1c289
+Top: ddb3776a9a203e24617cd4dd791350fe3ae34426
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:20 -0300
+
+Add probes for malloc arena changes.
+
+for ChangeLog
+
+ * malloc/arena.c (get_free_list): Add probe
+ memory_arena_reuse_free_list.
+ (reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
+ and memory_arena_reuse.
+ (arena_get2) [!PER_THREAD]: Likewise.
+ * malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
+ memory_arena_reuse_realloc.
+ * manual/probes.texi: Document them.
+
+
+---
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 0822fc8..89e8b92 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -775,6 +775,7 @@ get_free_list (void)
+
+ if (result != NULL)
+ {
++ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
+ (void)mutex_lock(&result->mutex);
+ tsd_setspecific(arena_key, (void *)result);
+ THREAD_STAT(++(result->stat_lock_loop));
+@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
+ result = result->next;
+
+ /* No arena available. Wait for the next in line. */
++ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
+ (void)mutex_lock(&result->mutex);
+
+ out:
++ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
+ tsd_setspecific(arena_key, (void *)result);
+ THREAD_STAT(++(result->stat_lock_loop));
+ next_to_use = result->next;
+@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
+ if (retried)
+ (void)mutex_unlock(&list_lock);
+ THREAD_STAT(++(a->stat_lock_loop));
++ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
+ tsd_setspecific(arena_key, (void *)a);
+ return a;
+ }
+@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
+ locks. */
+ if(!retried && mutex_trylock(&list_lock)) {
+ /* We will block to not run in a busy loop. */
++ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
+ (void)mutex_lock(&list_lock);
+
+ /* Since we blocked there might be an arena available now. */
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 5e23de2..46a1454 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
+ #endif
+
+ #if !defined PER_THREAD
++ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
+ /* As in malloc(), remember this arena for the next allocation. */
+ tsd_setspecific(arena_key, (void *)ar_ptr);
+ #endif
+diff --git a/manual/probes.texi b/manual/probes.texi
+index 9880eef..8e21190 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
+ at least @var{$arg2} bytes.
+ @end deftp
+
++@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
++This probe is hit when @code{malloc} has just selected an existing arena
++to reuse, and (temporarily) reserved it for exclusive use. Argument
++@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
++a pointer to the arena previously used by that thread.
++
++When per-thread arenas are enabled, this occurs within
++@code{reused_arena}, right after the mutex mentioned in probe
++@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
++point to the same arena. In this configuration, this will usually only
++occur once per thread. The exception is when a thread first selected
++the main arena, but a subsequent allocation from it fails: then, and
++only then, may we switch to another arena to retry that allocations, and
++for further allocations within that thread.
++
++When per-thread arenas are disabled, this occurs within
++@code{arena_get2}, whenever the mutex for the previously-selected arena
++cannot be immediately acquired.
++@end deftp
++
++@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
++This probe is hit when @code{malloc} is about to wait for an arena to
++become available for reuse. Argument @var{$arg1} holds a pointer to the
++mutex the thread is going to wait on, @var{$arg2} is a pointer to a
++newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
++arena previously used by that thread.
++
++When per-thread arenas are enabled, this occurs within
++@code{reused_arena}, when a thread first tries to allocate memory or
++needs a retry after a failure to allocate from the main arena, there
++isn't any free arena, the maximum number of arenas has been reached, and
++an existing arena was chosen for reuse, but its mutex could not be
++immediately acquired. The mutex in @var{$arg1} is the mutex of the
++selected arena.
++
++When per-thread arenas are disabled, this occurs within
++@code{arena_get2}, when a thread first tries to allocate memory or the
++mutex of the arena it previously used could not be immediately acquired,
++and none of the existing arenas could be immediately reserved for
++exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
++and since the arena won't have been selected yet, @var{$arg2} will be
++@code{NULL}.
++@end deftp
++
++@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
++This probe is hit when @code{malloc} has chosen an arena that is in the
++free list for use by a thread, within the @code{get_free_list} function.
++This probe is only available when @code{malloc} is configured to use
++per-thread arenas. The argument @var{$arg1} holds a pointer to the
++selected arena.
++@end deftp
++
++@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
++This probe is hit within @code{realloc}, as the arena of the current
++thread is changed to match that in which the given address was
++allocated. This probe is not available when @code{malloc} is configured
++to use per-thread arenas. The argument @var{$arg1} holds a pointer to
++the newly-selected arena.
++@end deftp
++
+ @deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+ This probe is hit when function @code{mallopt} is called to change
+ @code{malloc} internal configuration parameters, before any change to
diff --git a/patches/malloc-probe-arena-retry.patch b/patches/malloc-probe-arena-retry.patch
new file mode 100644
index 0000000..fe7b520
--- /dev/null
+++ b/patches/malloc-probe-arena-retry.patch
@@ -0,0 +1,50 @@
+Bottom: 98e970f78f5aaaa7568c1385ff494bfd3abe36a2
+Top: 9d4d6eaa4eb7480ef2542795e29ccad9cb9c63e5
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:21 -0300
+
+Add catch-all alloc retry probe.
+
+for ChangeLog
+
+ * malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
+ * manual/probes.texi: Document it.
+
+
+---
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 89e8b92..9ace186 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
+ static mstate
+ arena_get_retry (mstate ar_ptr, size_t bytes)
+ {
++ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
+ if(ar_ptr != &main_arena) {
+ (void)mutex_unlock(&ar_ptr->mutex);
+ ar_ptr = &main_arena;
+diff --git a/manual/probes.texi b/manual/probes.texi
+index ba30c0d..c5c2870 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
+ user-requested allocation size is in @var{$arg1}.
+ @end deftp
+
++@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
++This probe is hit within @code{arena_get_retry}, the function used by
++all of the corresponding functions above to select the alternate arena
++in which to retry the allocation, before the selection takes place.
++This probe is redundant, but much easier to use when it's not important
++to determine which memory allocation functions are failing to allocate
++in the first try. Argument @var{$arg1} is the same as in the
++function-specific probes, except for extra room for padding introduced
++by functions that have to ensure stricter alignment. Argument
++@var{$arg2} is the arena in which allocation failed.
++@end deftp
++
+ @deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+ This probe is hit when @code{malloc} allocated and initialized an
+ additional allocation arena (not the main arena), but before it is
diff --git a/patches/malloc-probe-heaps.patch b/patches/malloc-probe-heaps.patch
new file mode 100644
index 0000000..e8ef0a8
--- /dev/null
+++ b/patches/malloc-probe-heaps.patch
@@ -0,0 +1,132 @@
+Bottom: 9d4d6eaa4eb7480ef2542795e29ccad9cb9c63e5
+Top: 4f46302d23a22100ef99c3cd62f39c3d6880e526
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:21 -0300
+
+Add malloc probes for sbrk and heap resizing.
+
+for ChangeLog
+
+ * malloc/arena.c (new_heap): New memory_heap_new probe.
+ (grow_heap): New memory_heap_more probe.
+ (shrink_heap): New memory_heap_less probe.
+ (heap_trim): New memory_heap_free probe.
+ * malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
+ (systrim): New memory_sbrk_less probe.
+ * manual/probes.texi: Document them.
+
+
+---
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 9ace186..d81ed0d 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
+ h->size = size;
+ h->mprotect_size = size;
+ THREAD_STAT(stat_n_heaps++);
++ LIBC_PROBE (memory_heap_new, 2, h, h->size);
+ return h;
+ }
+
+@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
+ }
+
+ h->size = new_size;
++ LIBC_PROBE (memory_heap_more, 2, h, h->size);
+ return 0;
+ }
+
+@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
+ /*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
+
+ h->size = new_size;
++ LIBC_PROBE (memory_heap_less, 2, h, h->size);
+ return 0;
+ }
+
+@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
+ break;
+ ar_ptr->system_mem -= heap->size;
+ arena_mem -= heap->size;
++ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
+ delete_heap(heap);
+ heap = prev_heap;
+ if(!prev_inuse(p)) { /* consolidate backward */
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 54cdef8..b2684c6 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
+ below even if we cannot call MORECORE.
+ */
+
+- if (size > 0)
++ if (size > 0) {
+ brk = (char*)(MORECORE(size));
++ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
++ }
+
+ if (brk != (char*)(MORECORE_FAILURE)) {
+ /* Call the `morecore' hook if necessary. */
+@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
+ (*hook) ();
+ new_brk = (char*)(MORECORE(0));
+
++ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
++
+ if (new_brk != (char*)MORECORE_FAILURE) {
+ released = (long)(current_brk - new_brk);
+
+diff --git a/manual/probes.texi b/manual/probes.texi
+index c5c2870..40a241a 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -24,6 +24,46 @@ arguments.
+ These probes are designed to signal relatively unusual situations within
+ the virtual memory subsystem of @theglibc{}.
+
++@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit after the main arena is extended by calling
++@code{sbrk}. Argument @var{$arg1} is the additional size requested to
++@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
++@code{sbrk} area, returned in response to the request.
++@end deftp
++
++@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit after the main arena is shortened by calling
++@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
++(the positive value, rather than the negated number passed to
++@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
++@code{sbrk} area, returned in response to the request.
++@end deftp
++
++@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit after a new heap is @code{mmap}ed. Argument
++@var{$arg1} is a pointer to the base of the memory area, where the
++@code{heap_info} data structure is held, and @var{$arg2} is the size of
++the heap.
++@end deftp
++
++@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit before (unlike the other sbrk and heap probes) a heap
++is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
++the heap, and @var{$arg2} is the size of the heap.
++@end deftp
++
++@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit after a trailing portion of an @code{mmap}ed heap is
++released. Argument @var{$arg1} is a pointer to the heap, and
++@var{$arg2} is the new size of the heap.
++@end deftp
++
++@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit after a trailing portion of an @code{mmap}ed heap is
++extended. Argument @var{$arg1} is a pointer to the heap, and
++@var{$arg2} is the new size of the heap.
++@end deftp
++
+ @deftp Probe memory_malloc_retry (size_t @var{$arg1})
+ @deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+ @deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
diff --git a/patches/malloc-probe-retries.patch b/patches/malloc-probe-retries.patch
new file mode 100644
index 0000000..6cf0af2
--- /dev/null
+++ b/patches/malloc-probe-retries.patch
@@ -0,0 +1,103 @@
+Bottom: ddb3776a9a203e24617cd4dd791350fe3ae34426
+Top: 98e970f78f5aaaa7568c1385ff494bfd3abe36a2
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:20 -0300
+
+Add probes for malloc retries.
+
+for ChangeLog
+
+ * malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
+ (__libc_realloc): Add memory_realloc_retry probe.
+ (__libc_memalign): Add memory_memalign_retry probe.
+ (__libc_valloc): Add memory_valloc_retry probe.
+ (__libc_pvalloc): Add memory_pvalloc_retry probe.
+ (__libc_calloc): Add memory_calloc_retry probe.
+ * manual/probes.texi: Document them.
+
+
+---
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 46a1454..54cdef8 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
+ return 0;
+ victim = _int_malloc(ar_ptr, bytes);
+ if(!victim) {
++ LIBC_PROBE (memory_malloc_retry, 1, bytes);
+ ar_ptr = arena_get_retry(ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
+ victim = _int_malloc(ar_ptr, bytes);
+@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
+ if (newp == NULL)
+ {
+ /* Try harder to allocate memory in other arenas. */
++ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
+ newp = __libc_malloc(bytes);
+ if (newp != NULL)
+ {
+@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
+ return 0;
+ p = _int_memalign(ar_ptr, alignment, bytes);
+ if(!p) {
++ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
+ ar_ptr = arena_get_retry (ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
+ p = _int_memalign(ar_ptr, alignment, bytes);
+@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
+ return 0;
+ p = _int_valloc(ar_ptr, bytes);
+ if(!p) {
++ LIBC_PROBE (memory_valloc_retry, 1, bytes);
+ ar_ptr = arena_get_retry (ar_ptr, bytes);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
+ p = _int_memalign(ar_ptr, pagesz, bytes);
+@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
+ arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
+ p = _int_pvalloc(ar_ptr, bytes);
+ if(!p) {
++ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
+ ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
+ if (__builtin_expect(ar_ptr != NULL, 1)) {
+ p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
+@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
+ av == arena_for_chunk(mem2chunk(mem)));
+
+ if (mem == 0) {
++ LIBC_PROBE (memory_calloc_retry, 1, sz);
+ av = arena_get_retry (av, sz);
+ if (__builtin_expect(av != NULL, 1)) {
+ mem = _int_malloc(av, sz);
+diff --git a/manual/probes.texi b/manual/probes.texi
+index 8e21190..ba30c0d 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -24,6 +24,26 @@ arguments.
+ These probes are designed to signal relatively unusual situations within
+ the virtual memory subsystem of @theglibc{}.
+
++@deftp Probe memory_malloc_retry (size_t @var{$arg1})
++@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
++@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
++@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
++@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
++@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
++These probes are hit when the corresponding functions fail to obtain the
++requested amount of memory from the arena in use, before it retries on
++another arena. Argument @var{$arg1} is the amount of memory requested
++by the user; in the @code{calloc} case, that is the total size computed
++from both function arguments. In the @code{realloc} case, @var{$arg2}
++is the pointer to the memory area being resized. In the @code{memalign}
++case, @var{$arg2} is the alignment to be used for the request, which may
++be stricter than the value passed to the @code{memalign} function.
++
++Note that the argument order does NOT match that of the corresponding
++two-argument functions, so that in all of these probes the
++user-requested allocation size is in @var{$arg1}.
++@end deftp
++
+ @deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+ This probe is hit when @code{malloc} allocated and initialized an
+ additional allocation arena (not the main arena), but before it is
diff --git a/patches/malloc-probes.patch b/patches/malloc-probes.patch
new file mode 100644
index 0000000..999b581
--- /dev/null
+++ b/patches/malloc-probes.patch
@@ -0,0 +1,124 @@
+Bottom: 0a6de6636226d8398fba9c6b85e3ca5ec69a7ec4
+Top: 4969ad31dede55b8da5ec5768a38f977ec30dced
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:18 -0300
+
+Add first set of memory probes.
+
+for ChangeLog
+
+ * malloc/malloc.c: Include stap-probe.h.
+ (__libc_mallopt): Add memory_mallopt probe.
+ * malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
+ * manual/probes.texi: New.
+ * manual/Makefile (chapters): Add probes.
+ * manual/threads.texi: Set next node.
+
+
+---
+
+diff --git a/malloc/arena.c b/malloc/arena.c
+index 12a48ad..0822fc8 100644
+--- a/malloc/arena.c
++++ b/malloc/arena.c
+@@ -736,6 +736,7 @@ _int_new_arena(size_t size)
+ top(a) = (mchunkptr)ptr;
+ set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+
++ LIBC_PROBE (memory_arena_new, 2, a, size);
+ tsd_setspecific(arena_key, (void *)a);
+ mutex_init(&a->mutex);
+ (void)mutex_lock(&a->mutex);
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 70b9329..b68061b 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -1878,6 +1878,8 @@ static int perturb_byte;
+ #define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+
+
++#include <stap-probe.h>
++
+ /* ------------------- Support for multiple arenas -------------------- */
+ #include "arena.c"
+
+@@ -4674,6 +4676,8 @@ int __libc_mallopt(int param_number, int value)
+ /* Ensure initialization/consolidation */
+ malloc_consolidate(av);
+
++ LIBC_PROBE (memory_mallopt, 2, param_number, value);
++
+ switch(param_number) {
+ case M_MXFAST:
+ if (value >= 0 && value <= MAX_FAST_SIZE) {
+diff --git a/manual/Makefile b/manual/Makefile
+index 44c0fd4..7bb419a 100644
+--- a/manual/Makefile
++++ b/manual/Makefile
+@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
+ message search pattern io stdio llio filesys \
+ pipe socket terminal syslog math arith time \
+ resource setjmp signal startup process job nss \
+- users sysinfo conf crypt debug threads)
++ users sysinfo conf crypt debug threads probes)
+ add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
+ appendices = lang.texi header.texi install.texi maint.texi platform.texi \
+ contrib.texi
+diff --git a/manual/probes.texi b/manual/probes.texi
+new file mode 100644
+index 0000000..af07560
+--- /dev/null
++++ b/manual/probes.texi
+@@ -0,0 +1,41 @@
++@node Internal Probes
++@c @node Internal Probes, , Debugging Support, Top
++@c %MENU% Probes to monitor libc internal behavior
++@chapter Internal probes
++
++In order to aid in debugging and monitoring @glibcadj{} internal
++behavior, @theglibc{} exposes nearly-zero-overhead probes as Systemtap
++process marks with the @code{libc} provider.
++
++These probes are not part of the @glibcadj{} stable ABI, and they are
++subject to change or removal across releases. Our only promise with
++regard to them is that, if we find a need to remove or modify the
++arguments of a probe, the modified probe will have a different name, so
++that program monitors relying on the old probe will not get unexpected
++arguments.
++
++@menu
++* Memory Allocation Probes:: Probes in the memory allocation subsystem
++@end menu
++
++@node Memory Allocation Probes
++@section Memory Allocation Probes
++
++These probes are designed to signal relatively unusual situations within
++the virtual memory subsystem of @theglibc{}.
++
++@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
++This probe is hit when @code{malloc} allocated and initialized an
++additional allocation arena (not the main arena), but before it is
++assigned to the running thread and inserted in the internal linked list
++of arenas. The arena's @code{malloc_state} internal data structure is
++located at @var{$arg1}, within a newly-allocated heap big enough to hold
++at least @var{$arg2} bytes.
++@end deftp
++
++@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
++This probe is hit when function @code{mallopt} is called to change
++@code{malloc} internal configuration parameters, before any change to
++the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
++the ones passed to the @code{mallopt} function.
++@end deftp
+diff --git a/manual/threads.texi b/manual/threads.texi
+index 9a1df1a..79a82c7 100644
+--- a/manual/threads.texi
++++ b/manual/threads.texi
+@@ -1,5 +1,5 @@
+ @node POSIX Threads
+-@c @node POSIX Threads, , Cryptographic Functions, Top
++@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
+ @chapter POSIX Threads
+ @c %MENU% POSIX Threads
+ @cindex pthreads
diff --git a/patches/mallopt-detailed-probes.patch b/patches/mallopt-detailed-probes.patch
new file mode 100644
index 0000000..d3989bf
--- /dev/null
+++ b/patches/mallopt-detailed-probes.patch
@@ -0,0 +1,193 @@
+Bottom: 4969ad31dede55b8da5ec5768a38f977ec30dced
+Top: 0a849c59373d188b655eb565b331217df9a1c289
+Author: Alexandre Oliva <aoliva@redhat.com>
+Date: 2012-10-10 08:46:20 -0300
+
+Add probes for all changes to malloc options.
+
+for ChangeLog
+
+ * malloc/malloc.c (__libc_free): Add
+ memory_mallopt_free_dyn_thresholds probe.
+ (__libc_mallopt): Add multiple memory_mallopt probes.
+ * manual/probes.texi: Document them.
+
+
+---
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index b68061b..5e23de2 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
+ {
+ mp_.mmap_threshold = chunksize (p);
+ mp_.trim_threshold = 2 * mp_.mmap_threshold;
++ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
++ mp_.mmap_threshold, mp_.trim_threshold);
+ }
+ munmap_chunk(p);
+ return;
+@@ -4680,19 +4682,25 @@ int __libc_mallopt(int param_number, int value)
+
+ switch(param_number) {
+ case M_MXFAST:
+- if (value >= 0 && value <= MAX_FAST_SIZE) {
+- set_max_fast(value);
+- }
++ if (value >= 0 && value <= MAX_FAST_SIZE)
++ {
++ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
++ set_max_fast(value);
++ }
+ else
+ res = 0;
+ break;
+
+ case M_TRIM_THRESHOLD:
++ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
++ mp_.trim_threshold, mp_.no_dyn_threshold);
+ mp_.trim_threshold = value;
+ mp_.no_dyn_threshold = 1;
+ break;
+
+ case M_TOP_PAD:
++ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
++ mp_.top_pad, mp_.no_dyn_threshold);
+ mp_.top_pad = value;
+ mp_.no_dyn_threshold = 1;
+ break;
+@@ -4703,33 +4711,45 @@ int __libc_mallopt(int param_number, int value)
+ res = 0;
+ else
+ {
++ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
++ mp_.mmap_threshold, mp_.no_dyn_threshold);
+ mp_.mmap_threshold = value;
+ mp_.no_dyn_threshold = 1;
+ }
+ break;
+
+ case M_MMAP_MAX:
++ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
++ mp_.mmap_threshold, mp_.no_dyn_threshold);
+ mp_.n_mmaps_max = value;
+ mp_.no_dyn_threshold = 1;
+ break;
+
+ case M_CHECK_ACTION:
++ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
+ check_action = value;
+ break;
+
+ case M_PERTURB:
++ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
+ perturb_byte = value;
+ break;
+
+ #ifdef PER_THREAD
+ case M_ARENA_TEST:
+ if (value > 0)
+- mp_.arena_test = value;
++ {
++ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
++ mp_.arena_test = value;
++ }
+ break;
+
+ case M_ARENA_MAX:
+ if (value > 0)
+- mp_.arena_max = value;
++ {
++ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
++ mp_.arena_max = value;
++ }
+ break;
+ #endif
+ }
+diff --git a/manual/probes.texi b/manual/probes.texi
+index af07560..9880eef 100644
+--- a/manual/probes.texi
++++ b/manual/probes.texi
+@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
+ the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+ the ones passed to the @code{mallopt} function.
+ @end deftp
++
++@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_MXFAST}, and the requested value is
++in an acceptable range. Argument @var{$arg1} is the requested value,
++and @var{$arg2} is the previous value of this @code{malloc} parameter.
++@end deftp
++
++@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
++@var{$arg1} is the requested value, @var{$arg2} is the previous value of
++this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
++threshold adjustments was already disabled.
++@end deftp
++
++@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_TOP_PAD}. Argument @var{$arg1} is
++the requested value, @var{$arg2} is the previous value of this
++@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
++adjustments was already disabled.
++@end deftp
++
++@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_MMAP_THRESHOLD}, and the requested
++value is in an acceptable range. Argument @var{$arg1} is the requested
++value, @var{$arg2} is the previous value of this @code{malloc}
++parameter, and @var{$arg3} is nonzero if dynamic threshold adjustments
++was already disabled.
++@end deftp
++
++@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_MMAP_MAX}. Argument @var{$arg1} is
++the requested value, @var{$arg2} is the previous value of this
++@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
++adjustments was already disabled.
++@end deftp
++
++@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_CHECK_ACTION}. Argument @var{$arg1}
++is the requested value, and @var{$arg2} is the previous value of this
++@code{malloc} parameter.
++@end deftp
++
++@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_PERTURB}. Argument @var{$arg1} is
++the requested value, and @var{$arg2} is the previous value of this
++@code{malloc} parameter.
++@end deftp
++
++@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_ARENA_TEST}, and the requested value
++is in an acceptable range. Argument @var{$arg1} is the requested value,
++and @var{$arg2} is the previous value of this @code{malloc} parameter.
++This probe is not available if @code{malloc} is compiled without
++per-thread arenas (@samp{-DPER_THREAD}).
++@end deftp
++
++@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
++This probe is hit shortly after the @code{mallopt} probe, when the
++parameter to be changed is @code{M_ARENA_MAX}, and the requested value
++is in an acceptable range. Argument @var{$arg1} is the requested value,
++and @var{$arg2} is the previous value of this @code{malloc} parameter.
++This probe is not available if @code{malloc} is compiled without
++per-thread arenas (@samp{-DPER_THREAD}).
++@end deftp
++
++@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
++This probe is hit when function @code{free} decides to adjust the
++dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
++the adjusted mmap and trim thresholds, respectively.
++@end deftp
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6de33e11b341b140835f87c20ba88dd06c05f6d9
commit 6de33e11b341b140835f87c20ba88dd06c05f6d9
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:21 2012 -0300
Add malloc probes for sbrk and heap resizing.
for ChangeLog
* malloc/arena.c (new_heap): New memory_heap_new probe.
(grow_heap): New memory_heap_more probe.
(shrink_heap): New memory_heap_less probe.
(heap_trim): New memory_heap_free probe.
* malloc/malloc.c (sysmalloc): New memory_sbrk_more probe.
(systrim): New memory_sbrk_less probe.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 9ace186..d81ed0d 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -581,6 +581,7 @@ new_heap(size_t size, size_t top_pad)
h->size = size;
h->mprotect_size = size;
THREAD_STAT(stat_n_heaps++);
+ LIBC_PROBE (memory_heap_new, 2, h, h->size);
return h;
}
@@ -606,6 +607,7 @@ grow_heap(heap_info *h, long diff)
}
h->size = new_size;
+ LIBC_PROBE (memory_heap_more, 2, h, h->size);
return 0;
}
@@ -633,6 +635,7 @@ shrink_heap(heap_info *h, long diff)
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;
+ LIBC_PROBE (memory_heap_less, 2, h, h->size);
return 0;
}
@@ -674,6 +677,7 @@ heap_trim(heap_info *heap, size_t pad)
break;
ar_ptr->system_mem -= heap->size;
arena_mem -= heap->size;
+ LIBC_PROBE (memory_heap_free, 2, heap, heap->size);
delete_heap(heap);
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 54cdef8..b2684c6 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2448,8 +2448,10 @@ static void* sysmalloc(INTERNAL_SIZE_T nb, mstate av)
below even if we cannot call MORECORE.
*/
- if (size > 0)
+ if (size > 0) {
brk = (char*)(MORECORE(size));
+ LIBC_PROBE (memory_sbrk_more, 2, brk, size);
+ }
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
@@ -2747,6 +2749,8 @@ static int systrim(size_t pad, mstate av)
(*hook) ();
new_brk = (char*)(MORECORE(0));
+ LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
+
if (new_brk != (char*)MORECORE_FAILURE) {
released = (long)(current_brk - new_brk);
diff --git a/manual/probes.texi b/manual/probes.texi
index c5c2870..40a241a 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,46 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_sbrk_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is extended by calling
+@code{sbrk}. Argument @var{$arg1} is the additional size requested to
+@code{sbrk}, and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_sbrk_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after the main arena is shortened by calling
+@code{sbrk}. Argument @var{$arg1} is the size released by @code{sbrk}
+(the positive value, rather than the negated number passed to
+@code{sbrk}), and @var{$arg2} is the pointer that marks the end of the
+@code{sbrk} area, returned in response to the request.
+@end deftp
+
+@deftp Probe memory_heap_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a new heap is @code{mmap}ed. Argument
+@var{$arg1} is a pointer to the base of the memory area, where the
+@code{heap_info} data structure is held, and @var{$arg2} is the size of
+the heap.
+@end deftp
+
+@deftp Probe memory_heap_free (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit before (unlike the other sbrk and heap probes) a heap
+is completely un@code{mmap}ped. Argument @var{$arg1} is a pointer to
+the heap, and @var{$arg2} is the size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_less (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+released. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
+@deftp Probe memory_heap_more (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit after a trailing portion of an @code{mmap}ed heap is
+extended. Argument @var{$arg1} is a pointer to the heap, and
+@var{$arg2} is the new size of the heap.
+@end deftp
+
@deftp Probe memory_malloc_retry (size_t @var{$arg1})
@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1e514fab25b81088e2b4eba2acf0bdb85421a536
commit 1e514fab25b81088e2b4eba2acf0bdb85421a536
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:21 2012 -0300
Add catch-all alloc retry probe.
for ChangeLog
* malloc/arena.c (arena_get_retry): Add memory_arena_retry probe.
* manual/probes.texi: Document it.
diff --git a/malloc/arena.c b/malloc/arena.c
index 89e8b92..9ace186 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -932,6 +932,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
static mstate
arena_get_retry (mstate ar_ptr, size_t bytes)
{
+ LIBC_PROBE (memory_arena_retry, 2, bytes, ar_ptr);
if(ar_ptr != &main_arena) {
(void)mutex_unlock(&ar_ptr->mutex);
ar_ptr = &main_arena;
diff --git a/manual/probes.texi b/manual/probes.texi
index ba30c0d..c5c2870 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -44,6 +44,18 @@ two-argument functions, so that in all of these probes the
user-requested allocation size is in @var{$arg1}.
@end deftp
+@deftp Probe memory_arena_retry (size_t @var{$arg1}, void *@var{$arg2})
+This probe is hit within @code{arena_get_retry}, the function used by
+all of the corresponding functions above to select the alternate arena
+in which to retry the allocation, before the selection takes place.
+This probe is redundant, but much easier to use when it's not important
+to determine which memory allocation functions are failing to allocate
+in the first try. Argument @var{$arg1} is the same as in the
+function-specific probes, except for extra room for padding introduced
+by functions that have to ensure stricter alignment. Argument
+@var{$arg2} is the arena in which allocation failed.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ecd1ec40a0471b94913289731442f326e4d20ad2
commit ecd1ec40a0471b94913289731442f326e4d20ad2
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for malloc retries.
for ChangeLog
* malloc/malloc.c (__libc_malloc): Add memory_malloc_retry probe.
(__libc_realloc): Add memory_realloc_retry probe.
(__libc_memalign): Add memory_memalign_retry probe.
(__libc_valloc): Add memory_valloc_retry probe.
(__libc_pvalloc): Add memory_pvalloc_retry probe.
(__libc_calloc): Add memory_calloc_retry probe.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 46a1454..54cdef8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2856,6 +2856,7 @@ __libc_malloc(size_t bytes)
return 0;
victim = _int_malloc(ar_ptr, bytes);
if(!victim) {
+ LIBC_PROBE (memory_malloc_retry, 1, bytes);
ar_ptr = arena_get_retry(ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
victim = _int_malloc(ar_ptr, bytes);
@@ -2991,6 +2992,7 @@ __libc_realloc(void* oldmem, size_t bytes)
if (newp == NULL)
{
/* Try harder to allocate memory in other arenas. */
+ LIBC_PROBE (memory_realloc_retry, 2, bytes, oldmem);
newp = __libc_malloc(bytes);
if (newp != NULL)
{
@@ -3025,6 +3027,7 @@ __libc_memalign(size_t alignment, size_t bytes)
return 0;
p = _int_memalign(ar_ptr, alignment, bytes);
if(!p) {
+ LIBC_PROBE (memory_memalign_retry, 2, bytes, alignment);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, alignment, bytes);
@@ -3061,6 +3064,7 @@ __libc_valloc(size_t bytes)
return 0;
p = _int_valloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_valloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, bytes);
@@ -3095,6 +3099,7 @@ __libc_pvalloc(size_t bytes)
arena_get(ar_ptr, bytes + 2*pagesz + MINSIZE);
p = _int_pvalloc(ar_ptr, bytes);
if(!p) {
+ LIBC_PROBE (memory_pvalloc_retry, 1, bytes);
ar_ptr = arena_get_retry (ar_ptr, bytes + 2*pagesz + MINSIZE);
if (__builtin_expect(ar_ptr != NULL, 1)) {
p = _int_memalign(ar_ptr, pagesz, rounded_bytes);
@@ -3171,6 +3176,7 @@ __libc_calloc(size_t n, size_t elem_size)
av == arena_for_chunk(mem2chunk(mem)));
if (mem == 0) {
+ LIBC_PROBE (memory_calloc_retry, 1, sz);
av = arena_get_retry (av, sz);
if (__builtin_expect(av != NULL, 1)) {
mem = _int_malloc(av, sz);
diff --git a/manual/probes.texi b/manual/probes.texi
index 8e21190..ba30c0d 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -24,6 +24,26 @@ arguments.
These probes are designed to signal relatively unusual situations within
the virtual memory subsystem of @theglibc{}.
+@deftp Probe memory_malloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_realloc_retry (size_t @var{$arg1}, void *@var{$arg2})
+@deftpx Probe memory_memalign_retry (size_t @var{$arg1}, size_t @var{$arg2})
+@deftpx Probe memory_valloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_pvalloc_retry (size_t @var{$arg1})
+@deftpx Probe memory_calloc_retry (size_t @var{$arg1})
+These probes are hit when the corresponding functions fail to obtain the
+requested amount of memory from the arena in use, before it retries on
+another arena. Argument @var{$arg1} is the amount of memory requested
+by the user; in the @code{calloc} case, that is the total size computed
+from both function arguments. In the @code{realloc} case, @var{$arg2}
+is the pointer to the memory area being resized. In the @code{memalign}
+case, @var{$arg2} is the alignment to be used for the request, which may
+be stricter than the value passed to the @code{memalign} function.
+
+Note that the argument order does NOT match that of the corresponding
+two-argument functions, so that in all of these probes the
+user-requested allocation size is in @var{$arg1}.
+@end deftp
+
@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
This probe is hit when @code{malloc} allocated and initialized an
additional allocation arena (not the main arena), but before it is
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d4a518f876bf6280ec844094aa3184c31834dd50
commit d4a518f876bf6280ec844094aa3184c31834dd50
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for malloc arena changes.
for ChangeLog
* malloc/arena.c (get_free_list): Add probe
memory_arena_reuse_free_list.
(reused_arena) [PER_THREAD]: Add probes memory_arena_reuse_wait
and memory_arena_reuse.
(arena_get2) [!PER_THREAD]: Likewise.
* malloc/malloc.c (__libc_realloc) [!PER_THREAD]: Add probe
memory_arena_reuse_realloc.
* manual/probes.texi: Document them.
diff --git a/malloc/arena.c b/malloc/arena.c
index 0822fc8..89e8b92 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -775,6 +775,7 @@ get_free_list (void)
if (result != NULL)
{
+ LIBC_PROBE (memory_arena_reuse_free_list, 1, result);
(void)mutex_lock(&result->mutex);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
@@ -811,9 +812,11 @@ reused_arena (mstate avoid_arena)
result = result->next;
/* No arena available. Wait for the next in line. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &result->mutex, result, avoid_arena);
(void)mutex_lock(&result->mutex);
out:
+ LIBC_PROBE (memory_arena_reuse, 2, result, avoid_arena);
tsd_setspecific(arena_key, (void *)result);
THREAD_STAT(++(result->stat_lock_loop));
next_to_use = result->next;
@@ -892,6 +895,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
if (retried)
(void)mutex_unlock(&list_lock);
THREAD_STAT(++(a->stat_lock_loop));
+ LIBC_PROBE (memory_arena_reuse, 2, a, a_tsd);
tsd_setspecific(arena_key, (void *)a);
return a;
}
@@ -904,6 +908,7 @@ arena_get2(mstate a_tsd, size_t size, mstate avoid_arena)
locks. */
if(!retried && mutex_trylock(&list_lock)) {
/* We will block to not run in a busy loop. */
+ LIBC_PROBE (memory_arena_reuse_wait, 3, &list_lock, NULL, a_tsd);
(void)mutex_lock(&list_lock);
/* Since we blocked there might be an arena available now. */
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5e23de2..46a1454 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2977,6 +2977,7 @@ __libc_realloc(void* oldmem, size_t bytes)
#endif
#if !defined PER_THREAD
+ LIBC_PROBE (memory_arena_reuse_realloc, 1, ar_ptr);
/* As in malloc(), remember this arena for the next allocation. */
tsd_setspecific(arena_key, (void *)ar_ptr);
#endif
diff --git a/manual/probes.texi b/manual/probes.texi
index 9880eef..8e21190 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -33,6 +33,66 @@ located at @var{$arg1}, within a newly-allocated heap big enough to hold
at least @var{$arg2} bytes.
@end deftp
+@deftp Probe memory_arena_reuse (void *@var{$arg1}, void *@var{$arg2})
+This probe is hit when @code{malloc} has just selected an existing arena
+to reuse, and (temporarily) reserved it for exclusive use. Argument
+@var{$arg1} is a pointer to the newly-selected arena, and @var{$arg2} is
+a pointer to the arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, right after the mutex mentioned in probe
+@code{memory_arena_reuse_wait} is acquired; argument @var{$arg1} will
+point to the same arena. In this configuration, this will usually only
+occur once per thread. The exception is when a thread first selected
+the main arena, but a subsequent allocation from it fails: then, and
+only then, may we switch to another arena to retry that allocations, and
+for further allocations within that thread.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, whenever the mutex for the previously-selected arena
+cannot be immediately acquired.
+@end deftp
+
+@deftp Probe memory_arena_reuse_wait (void *@var{$arg1}, void *@var{$arg2}, void *@var{$arg3})
+This probe is hit when @code{malloc} is about to wait for an arena to
+become available for reuse. Argument @var{$arg1} holds a pointer to the
+mutex the thread is going to wait on, @var{$arg2} is a pointer to a
+newly-chosen arena to be reused, and @var{$arg3} is a pointer to the
+arena previously used by that thread.
+
+When per-thread arenas are enabled, this occurs within
+@code{reused_arena}, when a thread first tries to allocate memory or
+needs a retry after a failure to allocate from the main arena, there
+isn't any free arena, the maximum number of arenas has been reached, and
+an existing arena was chosen for reuse, but its mutex could not be
+immediately acquired. The mutex in @var{$arg1} is the mutex of the
+selected arena.
+
+When per-thread arenas are disabled, this occurs within
+@code{arena_get2}, when a thread first tries to allocate memory or the
+mutex of the arena it previously used could not be immediately acquired,
+and none of the existing arenas could be immediately reserved for
+exclusive use. The mutex in @var{$arg1} is that of the list of arenas,
+and since the arena won't have been selected yet, @var{$arg2} will be
+@code{NULL}.
+@end deftp
+
+@deftp Probe memory_arena_reuse_free_list (void *@var{$arg1})
+This probe is hit when @code{malloc} has chosen an arena that is in the
+free list for use by a thread, within the @code{get_free_list} function.
+This probe is only available when @code{malloc} is configured to use
+per-thread arenas. The argument @var{$arg1} holds a pointer to the
+selected arena.
+@end deftp
+
+@deftp Probe memory_arena_reuse_realloc (void *@var{$arg1})
+This probe is hit within @code{realloc}, as the arena of the current
+thread is changed to match that in which the given address was
+allocated. This probe is not available when @code{malloc} is configured
+to use per-thread arenas. The argument @var{$arg1} holds a pointer to
+the newly-selected arena.
+@end deftp
+
@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
This probe is hit when function @code{mallopt} is called to change
@code{malloc} internal configuration parameters, before any change to
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
commit bab4394d2f1a26bd4b9e2042f9e206074d3c2ea2
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:20 2012 -0300
Add probes for all changes to malloc options.
for ChangeLog
* malloc/malloc.c (__libc_free): Add
memory_mallopt_free_dyn_thresholds probe.
(__libc_mallopt): Add multiple memory_mallopt probes.
* manual/probes.texi: Document them.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b68061b..5e23de2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2896,6 +2896,8 @@ __libc_free(void* mem)
{
mp_.mmap_threshold = chunksize (p);
mp_.trim_threshold = 2 * mp_.mmap_threshold;
+ LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2,
+ mp_.mmap_threshold, mp_.trim_threshold);
}
munmap_chunk(p);
return;
@@ -4680,19 +4682,25 @@ int __libc_mallopt(int param_number, int value)
switch(param_number) {
case M_MXFAST:
- if (value >= 0 && value <= MAX_FAST_SIZE) {
- set_max_fast(value);
- }
+ if (value >= 0 && value <= MAX_FAST_SIZE)
+ {
+ LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
+ set_max_fast(value);
+ }
else
res = 0;
break;
case M_TRIM_THRESHOLD:
+ LIBC_PROBE (memory_mallopt_trim_threshold, 3, value,
+ mp_.trim_threshold, mp_.no_dyn_threshold);
mp_.trim_threshold = value;
mp_.no_dyn_threshold = 1;
break;
case M_TOP_PAD:
+ LIBC_PROBE (memory_mallopt_top_pad, 3, value,
+ mp_.top_pad, mp_.no_dyn_threshold);
mp_.top_pad = value;
mp_.no_dyn_threshold = 1;
break;
@@ -4703,33 +4711,45 @@ int __libc_mallopt(int param_number, int value)
res = 0;
else
{
+ LIBC_PROBE (memory_mallopt_mmap_threshold, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.mmap_threshold = value;
mp_.no_dyn_threshold = 1;
}
break;
case M_MMAP_MAX:
+ LIBC_PROBE (memory_mallopt_mmap_max, 3, value,
+ mp_.mmap_threshold, mp_.no_dyn_threshold);
mp_.n_mmaps_max = value;
mp_.no_dyn_threshold = 1;
break;
case M_CHECK_ACTION:
+ LIBC_PROBE (memory_mallopt_check_action, 2, value, check_action);
check_action = value;
break;
case M_PERTURB:
+ LIBC_PROBE (memory_mallopt_perturb, 2, value, perturb_byte);
perturb_byte = value;
break;
#ifdef PER_THREAD
case M_ARENA_TEST:
if (value > 0)
- mp_.arena_test = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_test, 2, value, mp_.arena_test);
+ mp_.arena_test = value;
+ }
break;
case M_ARENA_MAX:
if (value > 0)
- mp_.arena_max = value;
+ {
+ LIBC_PROBE (memory_mallopt_arena_max, 2, value, mp_.arena_max);
+ mp_.arena_max = value;
+ }
break;
#endif
}
diff --git a/manual/probes.texi b/manual/probes.texi
index af07560..9880eef 100644
--- a/manual/probes.texi
+++ b/manual/probes.texi
@@ -39,3 +39,81 @@ This probe is hit when function @code{mallopt} is called to change
the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
the ones passed to the @code{mallopt} function.
@end deftp
+
+@deftp Probe memory_mallopt_mxfast (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MXFAST}, and the requested value is
+in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_trim_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TRIM_THRESHOLD}. Argument
+@var{$arg1} is the requested value, @var{$arg2} is the previous value of
+this @code{malloc} parameter, and @var{$arg3} is nonzero if dynamic
+threshold adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_top_pad (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_TOP_PAD}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_threshold (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_THRESHOLD}, and the requested
+value is in an acceptable range. Argument @var{$arg1} is the requested
+value, @var{$arg2} is the previous value of this @code{malloc}
+parameter, and @var{$arg3} is nonzero if dynamic threshold adjustments
+was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_mmap_max (int @var{$arg1}, int @var{$arg2}, int @var{$arg3})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_MMAP_MAX}. Argument @var{$arg1} is
+the requested value, @var{$arg2} is the previous value of this
+@code{malloc} parameter, and @var{$arg3} is nonzero if dynamic threshold
+adjustments was already disabled.
+@end deftp
+
+@deftp Probe memory_mallopt_check_action (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_CHECK_ACTION}. Argument @var{$arg1}
+is the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_perturb (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_PERTURB}. Argument @var{$arg1} is
+the requested value, and @var{$arg2} is the previous value of this
+@code{malloc} parameter.
+@end deftp
+
+@deftp Probe memory_mallopt_arena_test (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_TEST}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_arena_max (int @var{$arg1}, int @var{$arg2})
+This probe is hit shortly after the @code{mallopt} probe, when the
+parameter to be changed is @code{M_ARENA_MAX}, and the requested value
+is in an acceptable range. Argument @var{$arg1} is the requested value,
+and @var{$arg2} is the previous value of this @code{malloc} parameter.
+This probe is not available if @code{malloc} is compiled without
+per-thread arenas (@samp{-DPER_THREAD}).
+@end deftp
+
+@deftp Probe memory_mallopt_free_dyn_thresholds (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{free} decides to adjust the
+dynamic brk/mmap thresholds. Argument @var{$arg1} and @var{$arg2} are
+the adjusted mmap and trim thresholds, respectively.
+@end deftp
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1fc3da00698e9bd1d512648d59e288b7125b0c7a
commit 1fc3da00698e9bd1d512648d59e288b7125b0c7a
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:18 2012 -0300
Add first set of memory probes.
for ChangeLog
* malloc/malloc.c: Include stap-probe.h.
(__libc_mallopt): Add memory_mallopt probe.
* malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
* manual/probes.texi: New.
* manual/Makefile (chapters): Add probes.
* manual/threads.texi: Set next node.
diff --git a/malloc/arena.c b/malloc/arena.c
index 12a48ad..0822fc8 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -736,6 +736,7 @@ _int_new_arena(size_t size)
top(a) = (mchunkptr)ptr;
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+ LIBC_PROBE (memory_arena_new, 2, a, size);
tsd_setspecific(arena_key, (void *)a);
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 70b9329..b68061b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1878,6 +1878,8 @@ static int perturb_byte;
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+#include <stap-probe.h>
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -4674,6 +4676,8 @@ int __libc_mallopt(int param_number, int value)
/* Ensure initialization/consolidation */
malloc_consolidate(av);
+ LIBC_PROBE (memory_mallopt, 2, param_number, value);
+
switch(param_number) {
case M_MXFAST:
if (value >= 0 && value <= MAX_FAST_SIZE) {
diff --git a/manual/Makefile b/manual/Makefile
index 44c0fd4..7bb419a 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug threads)
+ users sysinfo conf crypt debug threads probes)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
diff --git a/manual/probes.texi b/manual/probes.texi
new file mode 100644
index 0000000..500c243
--- /dev/null
+++ b/manual/probes.texi
@@ -0,0 +1,41 @@
+@node Internal Probes
+@c @node Internal Probes, , POSIX Threads, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
+In order to aid in debugging and monitoring @glibcadj{} internal
+behavior, @theglibc{} exposes nearly-zero-overhead probes as Systemtap
+process marks with the @code{libc} provider.
+
+These probes are not part of the @glibcadj{} stable ABI, and they are
+subject to change or removal across releases. Our only promise with
+regard to them is that, if we find a need to remove or modify the
+arguments of a probe, the modified probe will have a different name, so
+that program monitors relying on the old probe will not get unexpected
+arguments.
+
+@menu
+* Memory Allocation Probes:: Probes in the memory allocation subsystem
+@end menu
+
+@node Memory Allocation Probes
+@section Memory Allocation Probes
+
+These probes are designed to signal relatively unusual situations within
+the virtual memory subsystem of @theglibc{}.
+
+@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit when @code{malloc} allocated and initialized an
+additional allocation arena (not the main arena), but before it is
+assigned to the running thread and inserted in the internal linked list
+of arenas. The arena's @code{malloc_state} internal data structure is
+located at @var{$arg1}, within a newly-allocated heap big enough to hold
+at least @var{$arg2} bytes.
+@end deftp
+
+@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{mallopt} is called to change
+@code{malloc} internal configuration parameters, before any change to
+the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+the ones passed to the @code{mallopt} function.
+@end deftp
diff --git a/manual/threads.texi b/manual/threads.texi
index 9a1df1a..79a82c7 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -1,5 +1,5 @@
@node POSIX Threads
-@c @node POSIX Threads, , Cryptographic Functions, Top
+@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
@chapter POSIX Threads
@c %MENU% POSIX Threads
@cindex pthreads
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=03af2a91dae7e767e0ffc166d7e08a19e0330ffd
commit 03af2a91dae7e767e0ffc166d7e08a19e0330ffd
Author: Alexandre Oliva <aoliva@redhat.com>
Date: Wed Oct 10 08:46:18 2012 -0300
Add first set of memory probes.
for ChangeLog
* malloc/malloc.c: Include stap-probe.h.
(__libc_mallopt): Add memory_mallopt probe.
* malloc/arena.c (_int_new_arena): Add memory_arena_new probe.
* manual/probes.texi: New.
* manual/Makefile (chapters): Add probes.
* manual/threads.texi: Set next node.
diff --git a/malloc/arena.c b/malloc/arena.c
index 12a48ad..0822fc8 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -736,6 +736,7 @@ _int_new_arena(size_t size)
top(a) = (mchunkptr)ptr;
set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+ LIBC_PROBE (memory_arena_new, 2, a, size);
tsd_setspecific(arena_key, (void *)a);
mutex_init(&a->mutex);
(void)mutex_lock(&a->mutex);
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 70b9329..b68061b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1878,6 +1878,8 @@ static int perturb_byte;
#define free_perturb(p, n) memset (p, perturb_byte & 0xff, n)
+#include <stap-probe.h>
+
/* ------------------- Support for multiple arenas -------------------- */
#include "arena.c"
@@ -4674,6 +4676,8 @@ int __libc_mallopt(int param_number, int value)
/* Ensure initialization/consolidation */
malloc_consolidate(av);
+ LIBC_PROBE (memory_mallopt, 2, param_number, value);
+
switch(param_number) {
case M_MXFAST:
if (value >= 0 && value <= MAX_FAST_SIZE) {
diff --git a/manual/Makefile b/manual/Makefile
index 44c0fd4..7bb419a 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug threads)
+ users sysinfo conf crypt debug threads probes)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
diff --git a/manual/probes.texi b/manual/probes.texi
new file mode 100644
index 0000000..af07560
--- /dev/null
+++ b/manual/probes.texi
@@ -0,0 +1,41 @@
+@node Internal Probes
+@c @node Internal Probes, , Debugging Support, Top
+@c %MENU% Probes to monitor libc internal behavior
+@chapter Internal probes
+
+In order to aid in debugging and monitoring @glibcadj{} internal
+behavior, @theglibc{} exposes nearly-zero-overhead probes as Systemtap
+process marks with the @code{libc} provider.
+
+These probes are not part of the @glibcadj{} stable ABI, and they are
+subject to change or removal across releases. Our only promise with
+regard to them is that, if we find a need to remove or modify the
+arguments of a probe, the modified probe will have a different name, so
+that program monitors relying on the old probe will not get unexpected
+arguments.
+
+@menu
+* Memory Allocation Probes:: Probes in the memory allocation subsystem
+@end menu
+
+@node Memory Allocation Probes
+@section Memory Allocation Probes
+
+These probes are designed to signal relatively unusual situations within
+the virtual memory subsystem of @theglibc{}.
+
+@deftp Probe memory_arena_new (void *@var{$arg1}, size_t @var{$arg2})
+This probe is hit when @code{malloc} allocated and initialized an
+additional allocation arena (not the main arena), but before it is
+assigned to the running thread and inserted in the internal linked list
+of arenas. The arena's @code{malloc_state} internal data structure is
+located at @var{$arg1}, within a newly-allocated heap big enough to hold
+at least @var{$arg2} bytes.
+@end deftp
+
+@deftp Probe memory_mallopt (int @var{$arg1}, int @var{$arg2})
+This probe is hit when function @code{mallopt} is called to change
+@code{malloc} internal configuration parameters, before any change to
+the parameters is made. The arguments @var{$arg1} and @var{$arg2} are
+the ones passed to the @code{mallopt} function.
+@end deftp
diff --git a/manual/threads.texi b/manual/threads.texi
index 9a1df1a..79a82c7 100644
--- a/manual/threads.texi
+++ b/manual/threads.texi
@@ -1,5 +1,5 @@
@node POSIX Threads
-@c @node POSIX Threads, , Cryptographic Functions, Top
+@c @node POSIX Threads, Intenal Probes, Cryptographic Functions, Top
@chapter POSIX Threads
@c %MENU% POSIX Threads
@cindex pthreads
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources