fix build with CONFIG_STATS enabled

This commit is contained in:
Daniel Micay 2019-04-11 00:49:45 -04:00
parent 34b6754f70
commit 84a25ec83e
1 changed files with 17 additions and 17 deletions

View File

@ -448,43 +448,31 @@ static u64 get_random_canary(struct random_state *rng) {
}
static inline void stats_small_allocate(UNUSED struct size_class *c, UNUSED size_t size) {
#if STATS
#if CONFIG_STATS
c->allocated += size;
c->nmalloc++;
#endif
}
static inline void stats_small_deallocate(UNUSED struct size_class *c, UNUSED size_t size) {
#if STATS
#if CONFIG_STATS
c->allocated -= size;
c->ndalloc++;
#endif
}
static inline void stats_slab_allocate(UNUSED struct size_class *c, UNUSED size_t slab_size) {
#if STATS
#if CONFIG_STATS
c->slab_allocated += slab_size;
#endif
}
static inline void stats_slab_deallocate(UNUSED struct size_class *c, UNUSED size_t size) {
#if STATS
static inline void stats_slab_deallocate(UNUSED struct size_class *c, UNUSED size_t slab_size) {
#if CONFIG_STATS
c->slab_allocated -= slab_size;
#endif
}
static inline void stats_large_allocate(UNUSED struct region_allocator *ra, UNUSED size_t size) {
#if STATS
ra->allocated += size;
#endif
}
static inline void stats_large_deallocate(UNUSED struct region_allocator *ra, UNUSED size_t size) {
#if STATS
ra->allocated -= size;
#endif
}
static inline void *allocate_small(size_t requested_size) {
struct size_info info = get_size_info(requested_size);
size_t size = info.size ? info.size : 16;
@ -801,6 +789,18 @@ struct region_allocator {
struct random_state rng;
};
static inline void stats_large_allocate(UNUSED struct region_allocator *ra, UNUSED size_t size) {
#if CONFIG_STATS
ra->allocated += size;
#endif
}
static inline void stats_large_deallocate(UNUSED struct region_allocator *ra, UNUSED size_t size) {
#if CONFIG_STATS
ra->allocated -= size;
#endif
}
struct __attribute__((aligned(PAGE_SIZE))) slab_info_mapping {
struct slab_metadata slab_info[MAX_METADATA_MAX];
};