mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-04-14 22:51:50 +03:00
Add several USDT probes for hpa
This commit is contained in:
parent
3832502bed
commit
07a3742f72
2 changed files with 16 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
#include "jemalloc/internal/hpa_hooks.h"
|
||||
#include "jemalloc/internal/jemalloc_probe.h"
|
||||
|
||||
static void *hpa_hooks_map(size_t size);
|
||||
static void hpa_hooks_unmap(void *ptr, size_t size);
|
||||
|
|
@ -19,16 +20,20 @@ const hpa_hooks_t hpa_hooks_default = {&hpa_hooks_map, &hpa_hooks_unmap,
|
|||
static void *
|
||||
hpa_hooks_map(size_t size) {
|
||||
bool commit = true;
|
||||
return pages_map(NULL, size, HUGEPAGE, &commit);
|
||||
void *ret = pages_map(NULL, size, HUGEPAGE, &commit);
|
||||
JE_USDT(hpa_map, 2, size, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
hpa_hooks_unmap(void *ptr, size_t size) {
|
||||
JE_USDT(hpa_unmap, 2, size, ptr);
|
||||
pages_unmap(ptr, size);
|
||||
}
|
||||
|
||||
static void
|
||||
hpa_hooks_purge(void *ptr, size_t size) {
|
||||
JE_USDT(hpa_purge, 2, size, ptr);
|
||||
pages_purge_forced(ptr, size);
|
||||
}
|
||||
|
||||
|
|
@ -52,12 +57,14 @@ hpa_hooks_hugify(void *ptr, size_t size, bool sync) {
|
|||
if (sync) {
|
||||
err = pages_collapse(ptr, size);
|
||||
}
|
||||
JE_USDT(hpa_hugify, 4, size, ptr, err, sync);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void
|
||||
hpa_hooks_dehugify(void *ptr, size_t size) {
|
||||
bool err = pages_nohuge(ptr, size);
|
||||
JE_USDT(hpa_dehugify, 3, size, ptr, err);
|
||||
(void)err;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +85,9 @@ hpa_hooks_ms_since(nstime_t *past_nstime) {
|
|||
static bool
|
||||
hpa_hooks_vectorized_purge(void *vec, size_t vlen, size_t nbytes) {
|
||||
#ifdef JEMALLOC_HAVE_PROCESS_MADVISE
|
||||
return pages_purge_process_madvise(vec, vlen, nbytes);
|
||||
bool err = pages_purge_process_madvise(vec, vlen, nbytes);
|
||||
JE_USDT(hpa_vectorized_purge, 3, nbytes, vlen, err);
|
||||
return err;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||
|
||||
#include "jemalloc/internal/hpdata.h"
|
||||
#include "jemalloc/internal/jemalloc_probe.h"
|
||||
|
||||
static int
|
||||
hpdata_age_comp(const hpdata_t *a, const hpdata_t *b) {
|
||||
|
|
@ -100,6 +101,8 @@ hpdata_reserve_alloc(hpdata_t *hpdata, size_t sz) {
|
|||
hpdata->touched_pages, HUGEPAGE_PAGES, result, npages);
|
||||
fb_set_range(hpdata->touched_pages, HUGEPAGE_PAGES, result, npages);
|
||||
hpdata->h_ntouched += new_dirty;
|
||||
JE_USDT(hpa_reserve, 5, npages, hpdata->h_nactive, hpdata->h_ntouched,
|
||||
new_dirty, largest_unchosen_range);
|
||||
|
||||
/*
|
||||
* If we allocated out of a range that was the longest in the hpdata, it
|
||||
|
|
@ -160,6 +163,8 @@ hpdata_unreserve(hpdata_t *hpdata, void *addr, size_t sz) {
|
|||
hpdata->h_nactive -= npages;
|
||||
|
||||
hpdata_assert_consistent(hpdata);
|
||||
JE_USDT(hpa_unreserve, 5, npages, hpdata->h_nactive, hpdata->h_ntouched,
|
||||
old_longest_range, new_range_len);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue