mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-24 13:53:11 +00:00
Add several USDT probes for hpa
This commit is contained in:
committed by
Guangli Dai
parent
711fff750c
commit
f87bbab22c
@@ -2,6 +2,7 @@
|
|||||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||||
|
|
||||||
#include "jemalloc/internal/hpa_hooks.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_map(size_t size);
|
||||||
static void hpa_hooks_unmap(void *ptr, 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 *
|
static void *
|
||||||
hpa_hooks_map(size_t size) {
|
hpa_hooks_map(size_t size) {
|
||||||
bool commit = true;
|
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
|
static void
|
||||||
hpa_hooks_unmap(void *ptr, size_t size) {
|
hpa_hooks_unmap(void *ptr, size_t size) {
|
||||||
|
JE_USDT(hpa_unmap, 2, size, ptr);
|
||||||
pages_unmap(ptr, size);
|
pages_unmap(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hpa_hooks_purge(void *ptr, size_t size) {
|
hpa_hooks_purge(void *ptr, size_t size) {
|
||||||
|
JE_USDT(hpa_purge, 2, size, ptr);
|
||||||
pages_purge_forced(ptr, size);
|
pages_purge_forced(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,12 +57,14 @@ hpa_hooks_hugify(void *ptr, size_t size, bool sync) {
|
|||||||
if (sync) {
|
if (sync) {
|
||||||
err = pages_collapse(ptr, size);
|
err = pages_collapse(ptr, size);
|
||||||
}
|
}
|
||||||
|
JE_USDT(hpa_hugify, 4, size, ptr, err, sync);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hpa_hooks_dehugify(void *ptr, size_t size) {
|
hpa_hooks_dehugify(void *ptr, size_t size) {
|
||||||
bool err = pages_nohuge(ptr, size);
|
bool err = pages_nohuge(ptr, size);
|
||||||
|
JE_USDT(hpa_dehugify, 3, size, ptr, err);
|
||||||
(void)err;
|
(void)err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +85,9 @@ hpa_hooks_ms_since(nstime_t *past_nstime) {
|
|||||||
static bool
|
static bool
|
||||||
hpa_hooks_vectorized_purge(void *vec, size_t vlen, size_t nbytes) {
|
hpa_hooks_vectorized_purge(void *vec, size_t vlen, size_t nbytes) {
|
||||||
#ifdef JEMALLOC_HAVE_PROCESS_MADVISE
|
#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
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
#include "jemalloc/internal/jemalloc_internal_includes.h"
|
||||||
|
|
||||||
#include "jemalloc/internal/hpdata.h"
|
#include "jemalloc/internal/hpdata.h"
|
||||||
|
#include "jemalloc/internal/jemalloc_probe.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hpdata_age_comp(const hpdata_t *a, const hpdata_t *b) {
|
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);
|
hpdata->touched_pages, HUGEPAGE_PAGES, result, npages);
|
||||||
fb_set_range(hpdata->touched_pages, HUGEPAGE_PAGES, result, npages);
|
fb_set_range(hpdata->touched_pages, HUGEPAGE_PAGES, result, npages);
|
||||||
hpdata->h_ntouched += new_dirty;
|
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
|
* 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->h_nactive -= npages;
|
||||||
|
|
||||||
hpdata_assert_consistent(hpdata);
|
hpdata_assert_consistent(hpdata);
|
||||||
|
JE_USDT(hpa_unreserve, 5, npages, hpdata->h_nactive, hpdata->h_ntouched,
|
||||||
|
old_longest_range, new_range_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
|||||||
Reference in New Issue
Block a user