memblock tests: update style of comments for memblock_add_*() functions
Update comments in memblock_add_*() functions to match the style used in tests/alloc_*.c by rewording to make the expected outcome more apparent and, if more than one memblock is involved, adding a visual of the memory blocks. Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
This commit is contained in:
parent
672c0c5173
commit
23b5c7961f
|
@ -26,8 +26,8 @@ static int memblock_initialization_check(void)
|
||||||
/*
|
/*
|
||||||
* A simple test that adds a memory block of a specified base address
|
* A simple test that adds a memory block of a specified base address
|
||||||
* and size to the collection of available memory regions (memblock.memory).
|
* and size to the collection of available memory regions (memblock.memory).
|
||||||
* It checks if a new entry was created and if region counter and total memory
|
* Expect to create a new entry. The region counter and total memory get
|
||||||
* were correctly updated.
|
* updated.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_simple_check(void)
|
static int memblock_add_simple_check(void)
|
||||||
{
|
{
|
||||||
|
@ -53,10 +53,10 @@ static int memblock_add_simple_check(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A simple test that adds a memory block of a specified base address, size
|
* A simple test that adds a memory block of a specified base address, size,
|
||||||
* NUMA node and memory flags to the collection of available memory regions.
|
* NUMA node and memory flags to the collection of available memory regions.
|
||||||
* It checks if the new entry, region counter and total memory size have
|
* Expect to create a new entry. The region counter and total memory get
|
||||||
* expected values.
|
* updated.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_node_simple_check(void)
|
static int memblock_add_node_simple_check(void)
|
||||||
{
|
{
|
||||||
|
@ -87,9 +87,15 @@ static int memblock_add_node_simple_check(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A test that tries to add two memory blocks that don't overlap with one
|
* A test that tries to add two memory blocks that don't overlap with one
|
||||||
* another. It checks if two correctly initialized entries were added to the
|
* another:
|
||||||
* collection of available memory regions (memblock.memory) and if this
|
*
|
||||||
* change was reflected in memblock.memory's total size and region counter.
|
* | +--------+ +--------+ |
|
||||||
|
* | | r1 | | r2 | |
|
||||||
|
* +--------+--------+--------+--------+--+
|
||||||
|
*
|
||||||
|
* Expect to add two correctly initialized entries to the collection of
|
||||||
|
* available memory regions (memblock.memory). The total size and
|
||||||
|
* region counter fields get updated.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_disjoint_check(void)
|
static int memblock_add_disjoint_check(void)
|
||||||
{
|
{
|
||||||
|
@ -124,11 +130,21 @@ static int memblock_add_disjoint_check(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A test that tries to add two memory blocks, where the second one overlaps
|
* A test that tries to add two memory blocks r1 and r2, where r2 overlaps
|
||||||
* with the beginning of the first entry (that is r1.base < r2.base + r2.size).
|
* with the beginning of r1 (that is r1.base < r2.base + r2.size):
|
||||||
* After this, it checks if two entries are merged into one region that starts
|
*
|
||||||
* at r2.base and has size of two regions minus their intersection. It also
|
* | +----+----+------------+ |
|
||||||
* verifies the reported total size of the available memory and region counter.
|
* | | |r2 | r1 | |
|
||||||
|
* +----+----+----+------------+----------+
|
||||||
|
* ^ ^
|
||||||
|
* | |
|
||||||
|
* | r1.base
|
||||||
|
* |
|
||||||
|
* r2.base
|
||||||
|
*
|
||||||
|
* Expect to merge the two entries into one region that starts at r2.base
|
||||||
|
* and has size of two regions minus their intersection. The total size of
|
||||||
|
* the available memory is updated, and the region counter stays the same.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_overlap_top_check(void)
|
static int memblock_add_overlap_top_check(void)
|
||||||
{
|
{
|
||||||
|
@ -162,12 +178,21 @@ static int memblock_add_overlap_top_check(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A test that tries to add two memory blocks, where the second one overlaps
|
* A test that tries to add two memory blocks r1 and r2, where r2 overlaps
|
||||||
* with the end of the first entry (that is r2.base < r1.base + r1.size).
|
* with the end of r1 (that is r2.base < r1.base + r1.size):
|
||||||
* After this, it checks if two entries are merged into one region that starts
|
*
|
||||||
* at r1.base and has size of two regions minus their intersection. It verifies
|
* | +--+------+----------+ |
|
||||||
* that memblock can still see only one entry and has a correct total size of
|
* | | | r1 | r2 | |
|
||||||
* the available memory.
|
* +--+--+------+----------+--------------+
|
||||||
|
* ^ ^
|
||||||
|
* | |
|
||||||
|
* | r2.base
|
||||||
|
* |
|
||||||
|
* r1.base
|
||||||
|
*
|
||||||
|
* Expect to merge the two entries into one region that starts at r1.base
|
||||||
|
* and has size of two regions minus their intersection. The total size of
|
||||||
|
* the available memory is updated, and the region counter stays the same.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_overlap_bottom_check(void)
|
static int memblock_add_overlap_bottom_check(void)
|
||||||
{
|
{
|
||||||
|
@ -201,11 +226,19 @@ static int memblock_add_overlap_bottom_check(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A test that tries to add two memory blocks, where the second one is
|
* A test that tries to add two memory blocks r1 and r2, where r2 is
|
||||||
* within the range of the first entry (that is r1.base < r2.base &&
|
* within the range of r1 (that is r1.base < r2.base &&
|
||||||
* r2.base + r2.size < r1.base + r1.size). It checks if two entries are merged
|
* r2.base + r2.size < r1.base + r1.size):
|
||||||
* into one region that stays the same. The counter and total size of available
|
*
|
||||||
* memory are expected to not be updated.
|
* | +-------+--+-----------------------+
|
||||||
|
* | | |r2| r1 |
|
||||||
|
* +---+-------+--+-----------------------+
|
||||||
|
* ^
|
||||||
|
* |
|
||||||
|
* r1.base
|
||||||
|
*
|
||||||
|
* Expect to merge two entries into one region that stays the same.
|
||||||
|
* The counter and total size of available memory are not updated.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_within_check(void)
|
static int memblock_add_within_check(void)
|
||||||
{
|
{
|
||||||
|
@ -236,8 +269,8 @@ static int memblock_add_within_check(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A simple test that tries to add the same memory block twice. The counter
|
* A simple test that tries to add the same memory block twice. Expect
|
||||||
* and total size of available memory are expected to not be updated.
|
* the counter and total size of available memory to not be updated.
|
||||||
*/
|
*/
|
||||||
static int memblock_add_twice_check(void)
|
static int memblock_add_twice_check(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue