tcache.c (245868) | tcache.c (251300) |
---|---|
1#define JEMALLOC_TCACHE_C_ 2#include "jemalloc/internal/jemalloc_internal.h" 3 4/******************************************************************************/ 5/* Data. */ 6 7malloc_tsd_data(, tcache, tcache_t *, NULL) 8malloc_tsd_data(, tcache_enabled, tcache_enabled_t, tcache_enabled_default) --- 83 unchanged lines hidden (view full) --- 92 for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { 93 /* Lock the arena bin associated with the first object. */ 94 arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( 95 tbin->avail[0]); 96 arena_t *arena = chunk->arena; 97 arena_bin_t *bin = &arena->bins[binind]; 98 99 if (config_prof && arena == tcache->arena) { | 1#define JEMALLOC_TCACHE_C_ 2#include "jemalloc/internal/jemalloc_internal.h" 3 4/******************************************************************************/ 5/* Data. */ 6 7malloc_tsd_data(, tcache, tcache_t *, NULL) 8malloc_tsd_data(, tcache_enabled, tcache_enabled_t, tcache_enabled_default) --- 83 unchanged lines hidden (view full) --- 92 for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { 93 /* Lock the arena bin associated with the first object. */ 94 arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( 95 tbin->avail[0]); 96 arena_t *arena = chunk->arena; 97 arena_bin_t *bin = &arena->bins[binind]; 98 99 if (config_prof && arena == tcache->arena) { |
100 arena_prof_accum(arena, tcache->prof_accumbytes); | 100 if (arena_prof_accum(arena, tcache->prof_accumbytes)) 101 prof_idump(); |
101 tcache->prof_accumbytes = 0; 102 } 103 104 malloc_mutex_lock(&bin->lock); 105 if (config_stats && arena == tcache->arena) { 106 assert(merged_stats == false); 107 merged_stats = true; 108 bin->stats.nflushes++; --- 60 unchanged lines hidden (view full) --- 169 assert(binind < nhbins); 170 assert(rem <= tbin->ncached); 171 172 for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { 173 /* Lock the arena associated with the first object. */ 174 arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( 175 tbin->avail[0]); 176 arena_t *arena = chunk->arena; | 102 tcache->prof_accumbytes = 0; 103 } 104 105 malloc_mutex_lock(&bin->lock); 106 if (config_stats && arena == tcache->arena) { 107 assert(merged_stats == false); 108 merged_stats = true; 109 bin->stats.nflushes++; --- 60 unchanged lines hidden (view full) --- 170 assert(binind < nhbins); 171 assert(rem <= tbin->ncached); 172 173 for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) { 174 /* Lock the arena associated with the first object. */ 175 arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE( 176 tbin->avail[0]); 177 arena_t *arena = chunk->arena; |
178 UNUSED bool idump; |
|
177 | 179 |
180 if (config_prof) 181 idump = false; |
|
178 malloc_mutex_lock(&arena->lock); 179 if ((config_prof || config_stats) && arena == tcache->arena) { 180 if (config_prof) { | 182 malloc_mutex_lock(&arena->lock); 183 if ((config_prof || config_stats) && arena == tcache->arena) { 184 if (config_prof) { |
181 arena_prof_accum_locked(arena, | 185 idump = arena_prof_accum_locked(arena, |
182 tcache->prof_accumbytes); 183 tcache->prof_accumbytes = 0; 184 } 185 if (config_stats) { 186 merged_stats = true; 187 arena->stats.nrequests_large += 188 tbin->tstats.nrequests; 189 arena->stats.lstats[binind - NBINS].nrequests += --- 15 unchanged lines hidden (view full) --- 205 * Stash the object, so that it can be handled 206 * in a future pass. 207 */ 208 tbin->avail[ndeferred] = ptr; 209 ndeferred++; 210 } 211 } 212 malloc_mutex_unlock(&arena->lock); | 186 tcache->prof_accumbytes); 187 tcache->prof_accumbytes = 0; 188 } 189 if (config_stats) { 190 merged_stats = true; 191 arena->stats.nrequests_large += 192 tbin->tstats.nrequests; 193 arena->stats.lstats[binind - NBINS].nrequests += --- 15 unchanged lines hidden (view full) --- 209 * Stash the object, so that it can be handled 210 * in a future pass. 211 */ 212 tbin->avail[ndeferred] = ptr; 213 ndeferred++; 214 } 215 } 216 malloc_mutex_unlock(&arena->lock); |
217 if (config_prof && idump) 218 prof_idump(); |
|
213 } 214 if (config_stats && merged_stats == false) { 215 /* 216 * The flush loop didn't happen to flush to this thread's 217 * arena, so the stats didn't get merged. Manually do so now. 218 */ 219 arena_t *arena = tcache->arena; 220 malloc_mutex_lock(&arena->lock); --- 115 unchanged lines hidden (view full) --- 336 malloc_mutex_lock(&arena->lock); 337 arena->stats.nrequests_large += tbin->tstats.nrequests; 338 arena->stats.lstats[i - NBINS].nrequests += 339 tbin->tstats.nrequests; 340 malloc_mutex_unlock(&arena->lock); 341 } 342 } 343 | 219 } 220 if (config_stats && merged_stats == false) { 221 /* 222 * The flush loop didn't happen to flush to this thread's 223 * arena, so the stats didn't get merged. Manually do so now. 224 */ 225 arena_t *arena = tcache->arena; 226 malloc_mutex_lock(&arena->lock); --- 115 unchanged lines hidden (view full) --- 342 malloc_mutex_lock(&arena->lock); 343 arena->stats.nrequests_large += tbin->tstats.nrequests; 344 arena->stats.lstats[i - NBINS].nrequests += 345 tbin->tstats.nrequests; 346 malloc_mutex_unlock(&arena->lock); 347 } 348 } 349 |
344 if (config_prof && tcache->prof_accumbytes > 0) 345 arena_prof_accum(tcache->arena, tcache->prof_accumbytes); | 350 if (config_prof && tcache->prof_accumbytes > 0 && 351 arena_prof_accum(tcache->arena, tcache->prof_accumbytes)) 352 prof_idump(); |
346 347 tcache_size = arena_salloc(tcache, false); 348 if (tcache_size <= SMALL_MAXCLASS) { 349 arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache); 350 arena_t *arena = chunk->arena; 351 size_t pageind = ((uintptr_t)tcache - (uintptr_t)chunk) >> 352 LG_PAGE; 353 arena_chunk_map_t *mapelm = arena_mapp_get(chunk, pageind); --- 116 unchanged lines hidden --- | 353 354 tcache_size = arena_salloc(tcache, false); 355 if (tcache_size <= SMALL_MAXCLASS) { 356 arena_chunk_t *chunk = CHUNK_ADDR2BASE(tcache); 357 arena_t *arena = chunk->arena; 358 size_t pageind = ((uintptr_t)tcache - (uintptr_t)chunk) >> 359 LG_PAGE; 360 arena_chunk_map_t *mapelm = arena_mapp_get(chunk, pageind); --- 116 unchanged lines hidden --- |