mirror of https://github.com/schoebel/mars
mem: add prefer_freelist knob
This commit is contained in:
parent
43a77b8a70
commit
47f71d83cf
|
@ -606,10 +606,9 @@ void __brick_block_free(void *data, int order, int cline)
|
|||
|
||||
#ifdef CONFIG_MARS_MEM_PREALLOC
|
||||
int brick_allow_freelist = 1;
|
||||
EXPORT_SYMBOL_GPL(brick_allow_freelist);
|
||||
int brick_prefer_freelist = 1;
|
||||
|
||||
int brick_pre_reserve[BRICK_MAX_ORDER+1] = {};
|
||||
EXPORT_SYMBOL_GPL(brick_pre_reserve);
|
||||
|
||||
/* Note: we have no separate lists per CPU.
|
||||
* This should not hurt because the freelists are only used
|
||||
|
@ -933,7 +932,9 @@ void _brick_block_free(void *data, int len, int cline)
|
|||
}
|
||||
#endif /* BRICK_DEBUG_MEM */
|
||||
#ifdef CONFIG_MARS_MEM_PREALLOC
|
||||
if (order > 0 && brick_allow_freelist && atomic_read(&freelist_count[order]) <= brick_mem_freelist_max[order]) {
|
||||
if (order > 0 && brick_allow_freelist &&
|
||||
(brick_prefer_freelist ||
|
||||
atomic_read(&freelist_count[order]) <= brick_mem_freelist_max[order])) {
|
||||
_put_free(data, order);
|
||||
} else
|
||||
#endif
|
||||
|
|
|
@ -237,6 +237,7 @@ extern void _brick_block_free(void *data, int len, int cline);
|
|||
|
||||
#ifdef CONFIG_MARS_MEM_PREALLOC
|
||||
extern int brick_allow_freelist;
|
||||
extern int brick_prefer_freelist;
|
||||
|
||||
extern int brick_pre_reserve[BRICK_MAX_ORDER+1];
|
||||
extern int brick_mem_freelist_max[BRICK_MAX_ORDER+1];
|
||||
|
|
|
@ -650,6 +650,7 @@ struct ctl_table mars_table[] = {
|
|||
INT_ENTRY("mem_used_raw_kb", brick_global_block_used,0400),
|
||||
#ifdef CONFIG_MARS_MEM_PREALLOC
|
||||
INT_ENTRY("mem_allow_freelist", brick_allow_freelist, 0600),
|
||||
INT_ENTRY("mem_prefer_freelist", brick_prefer_freelist, 0600),
|
||||
VEC_INT_ENTRY("mem_freelist_max", brick_mem_freelist_max, 0600, BRICK_MAX_ORDER+1),
|
||||
VEC_INT_ENTRY("mem_alloc_count", brick_mem_alloc_count, 0400, BRICK_MAX_ORDER+1),
|
||||
VEC_INT_ENTRY("mem_alloc_max", brick_mem_alloc_count, 0600, BRICK_MAX_ORDER+1),
|
||||
|
|
Loading…
Reference in New Issue