@@ -158,23 +158,23 @@ block_allocator_strategy::best_fit(struct block_allocator::blockpair *blocks_arr
158
158
return best_bp;
159
159
}
160
160
161
- static uint64_t desired_fragmentation_divisor = 10 ;
161
+ static uint64_t padded_fit_alignment = 64 * 1024 ;
162
162
163
163
// TODO: These compiler specific directives should be abstracted in a portability header
164
164
// portability/toku_compiler.h?
165
165
__attribute__ ((__constructor__))
166
- static void determine_padded_fit_divisor_from_env (void ) {
166
+ static void determine_padded_fit_alignment_from_env (void ) {
167
167
// TODO: Should be in portability as 'toku_os_getenv()?'
168
- const char *s = getenv (" TOKU_BA_PADDED_FIT_DIVISOR " );
168
+ const char *s = getenv (" TOKU_BA_PADDED_FIT_ALIGNMENT " );
169
169
if (s != nullptr ) {
170
- const int64_t divisor = strtoll (s, nullptr , 10 );
171
- if (divisor < 0 ) {
172
- fprintf (stderr, " tokuft: error: block allocator padded fit divisor found in environment (%s), "
170
+ const int64_t alignment = strtoll (s, nullptr , 10 );
171
+ if (alignment < 0 ) {
172
+ fprintf (stderr, " tokuft: error: block allocator padded fit alignment found in environment (%s), "
173
173
" but it's out of range (should be an integer > 0). defaulting to 10\n " , s);
174
- desired_fragmentation_divisor = 10 ;
174
+ padded_fit_alignment = 64 * 1024 ;
175
175
} else {
176
- fprintf (stderr, " tokuft: setting block allocator padded fit divisor to %s \n " , s );
177
- desired_fragmentation_divisor = divisor ;
176
+ padded_fit_alignment = _next_power_of_two (alignment );
177
+ fprintf (stderr, " tokuft: setting block allocator padded fit alignment to % " PRIu64 " \n " , padded_fit_alignment) ;
178
178
}
179
179
}
180
180
}
@@ -185,10 +185,7 @@ static void determine_padded_fit_divisor_from_env(void) {
185
185
struct block_allocator ::blockpair *
186
186
block_allocator_strategy::padded_fit (struct block_allocator ::blockpair *blocks_array,
187
187
uint64_t n_blocks, uint64_t size, uint64_t alignment) {
188
- static const uint64_t absolute_max_padding = 128 * 1024 ;
189
- uint64_t desired_padding = size / desired_fragmentation_divisor;
190
- desired_padding = std::min (_next_power_of_two (desired_padding), absolute_max_padding);
191
- return _first_fit (blocks_array, n_blocks, size, alignment, true , desired_padding);
188
+ return _first_fit (blocks_array, n_blocks, size, alignment, true , padded_fit_alignment);
192
189
}
193
190
194
191
static double hot_zone_threshold = 0.85 ;
0 commit comments