kernel: Enhance naming of memory pool configuration options

Replaces confusing (and excessively long) configuration option
names with more intuitive names. Also enhances the description
of each option to clarify its use.

Change-Id: If4d4541407627482b1e90302cfc9df3bc8130d44
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
Allan Stephens 2016-11-15 12:33:54 -05:00 committed by Anas Nashif
commit ac4a351ba9
3 changed files with 39 additions and 24 deletions

View file

@ -202,9 +202,9 @@ Configuration Options
Related configuration options:
* :option:`CONFIG_MEM_POOL_AD_BEFORE_SEARCH_FOR_BIGGERBLOCK`
* :option:`CONFIG_MEM_POOL_AD_AFTER_SEARCH_FOR_BIGGERBLOCK`
* :option:`CONFIG_MEM_POOL_AD_NONE`
* :option:`CONFIG_MEM_POOL_SPLIT_BEFORE_DEFRAG`
* :option:`CONFIG_MEM_POOL_DEFRAG_BEFORE_SPLIT`
* :option:`CONFIG_MEM_POOL_SPLIT_ONLY`
APIs

View file

@ -285,29 +285,44 @@ config SEMAPHORE_GROUPS
the k_sem_give() routine.
choice
prompt "Memory pools auto-defragmentation policy"
default MEM_POOL_AD_AFTER_SEARCH_FOR_BIGGERBLOCK
prompt "Memory pool block allocation policy"
default MEM_POOL_SPLIT_BEFORE_DEFRAG
help
Memory pool auto-defragmentation is performed if a memory
block of the requested size can not be found. Defragmentation
can be done:
Before trying to find a block in the next largest block set.
This is an attempt to preserve the memory pool's larger blocks
by fragmenting them only when necessary (i.e. at the cost of
doing more frequent auto-defragmentations).
After trying to find a block in the next largest block set.
This is an attempt to limit the cost of doing auto-defragmentations
by doing them only when necessary (i.e. at the cost of fragmenting
the memory pool's larger blocks).
This option specifies how a memory pool reacts if an unused memory
block of the required size is not available.
config MEM_POOL_AD_NONE
bool "No auto-defragmentation"
config MEM_POOL_SPLIT_BEFORE_DEFRAG
bool "Split a larger block before merging smaller blocks"
help
This option instruct a memory pool to try splitting a larger unused
block if an unused block of the required size is not available; only
if no such blocks exist will the memory pool try merging smaller unused
blocks. This policy attempts to limit the cost of performing automatic
partial defragmention of the memory pool, at the cost of fragmenting
the memory pool's larger blocks.
config MEM_POOL_AD_BEFORE_SEARCH_FOR_BIGGERBLOCK
bool "Before trying to find a block in the next largest block set"
config MEM_POOL_DEFRAG_BEFORE_SPLIT
bool "Merge smaller blocks before splitting a larger block"
help
This option instructs a memory pool to try merging smaller unused
blocks if an unused block of the required size is not available; only
if this does not generate a sufficiently large block will the memory
pool try splitting a larger unused block. This policy attempts to
preserve the memory pool's larger blocks, at the cost of performing
automatic partial defragmentations more frequently.
config MEM_POOL_AD_AFTER_SEARCH_FOR_BIGGERBLOCK
bool "After trying to find a block in the next largest block set"
config MEM_POOL_SPLIT_ONLY
bool "Split a larger block, but never merge smaller blocks"
help
This option instructs a memory pool to try splitting a larger unused
block if an unused block of the required size is not available; if no
such blocks exist the block allocation operation fails. This policy
attempts to limit the cost of defragmenting the memory pool by avoiding
automatic partial defragmentation, at the cost of requiring the
application to explicitly request a full defragmentation of the memory
pool when an allocation fails. Depending on how a memory pool is used,
it may be more efficient for a memory pool to perform an occasional
full defragmentation than to perform frequent partial defragmentations.
endchoice

View file

@ -342,7 +342,7 @@ static char *get_block_recursive(struct k_mem_pool *pool,
return found;
}
#ifdef CONFIG_MEM_POOL_AD_BEFORE_SEARCH_FOR_BIGGERBLOCK
#ifdef CONFIG_MEM_POOL_DEFRAG_BEFORE_SPLIT
/*
* do a partial defragmentation of memory pool & try allocating again
* - do this on initial invocation only, not recursive ones
@ -385,7 +385,7 @@ static char *get_block_recursive(struct k_mem_pool *pool,
return larger_block;
}
#ifdef CONFIG_MEM_POOL_AD_AFTER_SEARCH_FOR_BIGGERBLOCK
#ifdef CONFIG_MEM_POOL_SPLIT_BEFORE_DEFRAG
/*
* do a partial defragmentation of memory pool & try allocating again
* - do this on initial invocation only, not recursive ones