Lines Matching full:memory

17 	ASSERT_NE(memblock.memory.regions, NULL);  in memblock_initialization_check()
18 ASSERT_EQ(memblock.memory.cnt, 0); in memblock_initialization_check()
19 ASSERT_EQ(memblock.memory.max, EXPECTED_MEMBLOCK_REGIONS); in memblock_initialization_check()
20 ASSERT_EQ(strcmp(memblock.memory.name, "memory"), 0); in memblock_initialization_check()
24 ASSERT_EQ(memblock.memory.max, EXPECTED_MEMBLOCK_REGIONS); in memblock_initialization_check()
36 * A simple test that adds a memory block of a specified base address
37 * and size to the collection of available memory regions (memblock.memory).
38 * Expect to create a new entry. The region counter and total memory get
45 rgn = &memblock.memory.regions[0]; in memblock_add_simple_check()
60 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_simple_check()
61 ASSERT_EQ(memblock.memory.total_size, r.size); in memblock_add_simple_check()
69 * A simple test that adds a memory block of a specified base address, size,
70 * NUMA node and memory flags to the collection of available memory regions.
71 * Expect to create a new entry. The region counter and total memory get
78 rgn = &memblock.memory.regions[0]; in memblock_add_node_simple_check()
97 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_node_simple_check()
98 ASSERT_EQ(memblock.memory.total_size, r.size); in memblock_add_node_simple_check()
106 * A test that tries to add two memory blocks that don't overlap with one
114 * available memory regions (memblock.memory). The total size and
121 rgn1 = &memblock.memory.regions[0]; in memblock_add_disjoint_check()
122 rgn2 = &memblock.memory.regions[1]; in memblock_add_disjoint_check()
145 ASSERT_EQ(memblock.memory.cnt, 2); in memblock_add_disjoint_check()
146 ASSERT_EQ(memblock.memory.total_size, r1.size + r2.size); in memblock_add_disjoint_check()
154 * A test that tries to add two memory blocks r1 and r2, where r2 overlaps
168 * the available memory is updated, and the region counter stays the same.
175 rgn = &memblock.memory.regions[0]; in memblock_add_overlap_top_check()
197 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_overlap_top_check()
198 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_add_overlap_top_check()
206 * A test that tries to add two memory blocks r1 and r2, where r2 overlaps
220 * the available memory is updated, and the region counter stays the same.
227 rgn = &memblock.memory.regions[0]; in memblock_add_overlap_bottom_check()
249 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_overlap_bottom_check()
250 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_add_overlap_bottom_check()
258 * A test that tries to add two memory blocks r1 and r2, where r2 is
270 * The counter and total size of available memory are not updated.
276 rgn = &memblock.memory.regions[0]; in memblock_add_within_check()
296 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_within_check()
297 ASSERT_EQ(memblock.memory.total_size, r1.size); in memblock_add_within_check()
305 * A simple test that tries to add the same memory block twice. Expect
306 * the counter and total size of available memory to not be updated.
322 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_twice_check()
323 ASSERT_EQ(memblock.memory.total_size, r.size); in memblock_add_twice_check()
331 * A test that tries to add two memory blocks that don't overlap with one
332 * another and then add a third memory block in the space between the first two:
340 * size of the available memory are updated.
347 rgn = &memblock.memory.regions[0]; in memblock_add_between_check()
374 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_between_check()
375 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_add_between_check()
383 * A simple test that tries to add a memory block r when r extends past
393 * Expect to add a memory block of size PHYS_ADDR_MAX - r.base. Expect the
394 * total size of available memory and the counter to be updated.
401 rgn = &memblock.memory.regions[0]; in memblock_add_near_max_check()
418 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_add_near_max_check()
419 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_add_near_max_check()
427 * A test that trying to add the 129th memory block.
429 * memblock.memory.max, find a new valid memory as
430 * memory.regions.
451 * We allocated enough memory by using dummy_physical_memory_init(), and in memblock_add_many_check()
452 * split it into small block. First we split a large enough memory block in memblock_add_many_check()
453 * as the memory region which will be choosed by memblock_double_array(). in memblock_add_many_check()
460 /* This is the base of small memory block. */ in memblock_add_many_check()
463 orig_region = memblock.memory.regions; in memblock_add_many_check()
468 * gap between the nearby memory to avoid being merged. in memblock_add_many_check()
473 ASSERT_EQ(memblock.memory.cnt, i + 2); in memblock_add_many_check()
474 ASSERT_EQ(memblock.memory.total_size, new_memory_regions_size + in memblock_add_many_check()
480 * update the memory.max. in memblock_add_many_check()
482 ASSERT_EQ(memblock.memory.max, INIT_MEMBLOCK_REGIONS * 2); in memblock_add_many_check()
484 /* memblock_double_array() will reserve the memory it used. Check it. */ in memblock_add_many_check()
493 ASSERT_EQ(memblock.memory.regions[0].base, r.base); in memblock_add_many_check()
494 ASSERT_EQ(memblock.memory.regions[0].size, r.size); in memblock_add_many_check()
496 ASSERT_EQ(memblock.memory.cnt, INIT_MEMBLOCK_REGIONS + 2); in memblock_add_many_check()
497 ASSERT_EQ(memblock.memory.total_size, INIT_MEMBLOCK_REGIONS * size + in memblock_add_many_check()
500 ASSERT_EQ(memblock.memory.max, INIT_MEMBLOCK_REGIONS * 2); in memblock_add_many_check()
505 * The current memory.regions is occupying a range of memory that in memblock_add_many_check()
506 * allocated from dummy_physical_memory_init(). After free the memory, in memblock_add_many_check()
507 * we must not use it. So restore the origin memory region to make sure in memblock_add_many_check()
510 memblock.memory.regions = orig_region; in memblock_add_many_check()
511 memblock.memory.cnt = INIT_MEMBLOCK_REGIONS; in memblock_add_many_check()
541 * A simple test that marks a memory block of a specified base address
542 * and size as reserved and to the collection of reserved memory regions
544 * and total memory size are updated.
571 * A test that tries to mark two memory blocks that don't overlap as reserved:
577 * Expect to add two entries to the collection of reserved memory regions
618 * A test that tries to mark two memory blocks r1 and r2 as reserved,
633 * reserved memory is updated, and the region counter is not updated.
671 * A test that tries to mark two memory blocks r1 and r2 as reserved,
686 * reserved memory is updated, and the region counter is not updated.
724 * A test that tries to mark two memory blocks r1 and r2 as reserved,
738 * counter and total size of available memory are not updated.
773 * A simple test that tries to reserve the same memory block twice.
774 * Expect the region counter and total size of reserved memory to not
800 * A test that tries to mark two memory blocks that don't overlap as reserved
801 * and then reserve a third memory block in the space between the first two:
852 * A simple test that tries to reserve a memory block r when r extends past
862 * Expect to reserve a memory block of size PHYS_ADDR_MAX - r.base. Expect the
863 * total size of reserved memory and the counter to be updated.
896 * A test that trying to reserve the 129th memory block.
898 * memblock.memory.max, find a new valid memory as
917 /* Add a valid memory region used by double_array(). */ in memblock_reserve_many_check()
922 /* Reserve some fakes memory region to fulfill the memblock. */ in memblock_reserve_many_check()
928 /* Keep the gap so these memory region will not be merged. */ in memblock_reserve_many_check()
938 * This is the memory region size used by the doubled reserved.regions, in memblock_reserve_many_check()
945 * The double_array() will find a free memory region as the new in memblock_reserve_many_check()
946 * reserved.regions, and the used memory region will be reserved, so in memblock_reserve_many_check()
972 * The current reserved.regions is occupying a range of memory that in memblock_reserve_many_check()
973 * allocated from dummy_physical_memory_init(). After free the memory, in memblock_reserve_many_check()
974 * we must not use it. So restore the origin memory region to make sure in memblock_reserve_many_check()
987 * A test that trying to reserve the 129th memory block at all locations.
989 * memblock.memory.max, find a new valid memory as reserved.regions.
998 /* Keep the gap so these memory region will not be merged. */
1012 /* Reserve the 129th memory block for all possible positions*/ in memblock_reserve_all_locations_check()
1017 /* Add a valid memory region used by double_array(). */ in memblock_reserve_all_locations_check()
1025 /* Reserve some fakes memory region to fulfill the memblock. */ in memblock_reserve_all_locations_check()
1043 * This is the memory region size used by the doubled reserved.regions, in memblock_reserve_all_locations_check()
1050 * The double_array() will find a free memory region as the new in memblock_reserve_all_locations_check()
1051 * reserved.regions, and the used memory region will be reserved, so in memblock_reserve_all_locations_check()
1077 * The current reserved.regions is occupying a range of memory that in memblock_reserve_all_locations_check()
1078 * allocated from dummy_physical_memory_init(). After free the memory, in memblock_reserve_all_locations_check()
1079 * we must not use it. So restore the origin memory region to make sure in memblock_reserve_all_locations_check()
1092 * A test that trying to reserve the 129th memory block at all locations.
1094 * memblock.memory.max, find a new valid memory as reserved.regions. And make
1099 * an available range in memory for the new array. We intended to put two
1100 * ranges in memory with one is the exact range of the skipped one. Before
1103 * conflict. The expected new array should be allocated from memory.regions[0].
1106 * memory +-------+ +-------+
1121 /* Keep the gap so these memory region will not be merged. */
1139 * Pre-allocate the range for 129 memory block + one range for double in memblock_reserve_many_may_conflict_check()
1148 /* Reserve the 129th memory block for all possible positions*/ in memblock_reserve_many_may_conflict_check()
1154 /* Add a valid memory region used by double_array(). */ in memblock_reserve_many_may_conflict_check()
1157 * Add a memory region which will be reserved as 129th memory in memblock_reserve_many_may_conflict_check()
1166 /* Reserve some fakes memory region to fulfill the memblock. */ in memblock_reserve_many_may_conflict_check()
1184 * This is the memory region size used by the doubled reserved.regions, in memblock_reserve_many_may_conflict_check()
1191 * The double_array() will find a free memory region as the new in memblock_reserve_many_may_conflict_check()
1192 * reserved.regions, and the used memory region will be reserved, so in memblock_reserve_many_may_conflict_check()
1225 * The current reserved.regions is occupying a range of memory that in memblock_reserve_many_may_conflict_check()
1226 * allocated from dummy_physical_memory_init(). After free the memory, in memblock_reserve_many_may_conflict_check()
1227 * we must not use it. So restore the origin memory region to make sure in memblock_reserve_many_may_conflict_check()
1266 * available memory regions. By "removing" a region we mean overwriting it
1267 * with the next region r2 in memblock.memory:
1276 * Expect to add two memory blocks r1 and r2 and then remove r1 so that
1284 rgn = &memblock.memory.regions[0]; in memblock_remove_simple_check()
1305 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_remove_simple_check()
1306 ASSERT_EQ(memblock.memory.total_size, r2.size); in memblock_remove_simple_check()
1315 * available memory (i.e. has no corresponding entry in memblock.memory):
1333 rgn = &memblock.memory.regions[0]; in memblock_remove_absent_check()
1353 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_remove_absent_check()
1354 ASSERT_EQ(memblock.memory.total_size, r1.size); in memblock_remove_absent_check()
1378 * available memory pool. The regions counter and total size are updated.
1385 rgn = &memblock.memory.regions[0]; in memblock_remove_overlap_top_check()
1409 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_remove_overlap_top_check()
1410 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_remove_overlap_top_check()
1432 * available memory pool. The regions counter and total size are updated.
1439 rgn = &memblock.memory.regions[0]; in memblock_remove_overlap_bottom_check()
1461 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_remove_overlap_bottom_check()
1462 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_remove_overlap_bottom_check()
1493 rgn1 = &memblock.memory.regions[0]; in memblock_remove_within_check()
1494 rgn2 = &memblock.memory.regions[1]; in memblock_remove_within_check()
1521 ASSERT_EQ(memblock.memory.cnt, 2); in memblock_remove_within_check()
1522 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_remove_within_check()
1531 * available memory regions when r1 is the only available region.
1532 * Expect to add a memory block r1 and then remove r1 so that a dummy
1540 rgn = &memblock.memory.regions[0]; in memblock_remove_only_region_check()
1556 ASSERT_EQ(memblock.memory.cnt, 0); in memblock_remove_only_region_check()
1557 ASSERT_EQ(memblock.memory.total_size, 0); in memblock_remove_only_region_check()
1566 * memory regions when r2 extends past PHYS_ADDR_MAX:
1576 * Expect the total size of available memory to be updated and the counter to
1584 rgn = &memblock.memory.regions[0]; in memblock_remove_near_max_check()
1607 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_remove_near_max_check()
1608 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_remove_near_max_check()
1627 * from the available memory pool. Expect the total size of available memory to
1635 rgn1 = &memblock.memory.regions[0]; in memblock_remove_overlap_two_check()
1636 rgn2 = &memblock.memory.regions[1]; in memblock_remove_overlap_two_check()
1670 ASSERT_EQ(memblock.memory.cnt, 2); in memblock_remove_overlap_two_check()
1671 ASSERT_EQ(memblock.memory.total_size, total_size); in memblock_remove_overlap_two_check()
1699 * A simple test that tries to free a memory block r1 that was marked
1710 * Expect to reserve two memory regions and then erase r1 region with the
1958 * A simple test that tries to free a memory block r1 that was marked
1960 * Expect to reserve a memory block r1 and then free r1 so that r1 is
2003 * Expect the total size of reserved memory to be updated and the counter to
2054 * from the collection of reserved memory. Expect the total size of reserved
2055 * memory to be updated and the counter to not be updated.
2170 * A test that tries to trim memory when both ends of the memory region are
2171 * aligned. Expect that the memory will not be trimmed. Expect the counter to
2179 rgn = &memblock.memory.regions[0]; in memblock_trim_memory_aligned_check()
2195 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_trim_memory_aligned_check()
2203 * A test that tries to trim memory when there are two available regions, r1 and
2225 rgn = &memblock.memory.regions[0]; in memblock_trim_memory_too_small_check()
2246 ASSERT_EQ(memblock.memory.cnt, 1); in memblock_trim_memory_too_small_check()
2254 * A test that tries to trim memory when there are two available regions, r1 and
2279 rgn1 = &memblock.memory.regions[0]; in memblock_trim_memory_unaligned_base_check()
2280 rgn2 = &memblock.memory.regions[1]; in memblock_trim_memory_unaligned_base_check()
2307 ASSERT_EQ(memblock.memory.cnt, 2); in memblock_trim_memory_unaligned_base_check()
2315 * A test that tries to trim memory when there are two available regions, r1 and
2340 rgn1 = &memblock.memory.regions[0]; in memblock_trim_memory_unaligned_end_check()
2341 rgn2 = &memblock.memory.regions[1]; in memblock_trim_memory_unaligned_end_check()
2367 ASSERT_EQ(memblock.memory.cnt, 2); in memblock_trim_memory_unaligned_end_check()
2403 ASSERT_FALSE(memblock_overlaps_region(&memblock.memory, SZ_1M, SZ_1M)); in memblock_overlaps_region_check()
2404 ASSERT_FALSE(memblock_overlaps_region(&memblock.memory, SZ_2G, SZ_1M)); in memblock_overlaps_region_check()
2407 ASSERT_FALSE(memblock_overlaps_region(&memblock.memory, SZ_1G - SZ_1M, SZ_1M)); in memblock_overlaps_region_check()
2408 ASSERT_FALSE(memblock_overlaps_region(&memblock.memory, SZ_1G + SZ_4M, SZ_1M)); in memblock_overlaps_region_check()
2411 ASSERT_TRUE(memblock_overlaps_region(&memblock.memory, SZ_1G - SZ_1M, SZ_2M)); in memblock_overlaps_region_check()
2412 ASSERT_TRUE(memblock_overlaps_region(&memblock.memory, SZ_1G + SZ_2M, SZ_2M)); in memblock_overlaps_region_check()
2415 ASSERT_TRUE(memblock_overlaps_region(&memblock.memory, SZ_1G, SZ_4M)); in memblock_overlaps_region_check()
2416 ASSERT_TRUE(memblock_overlaps_region(&memblock.memory, SZ_1G - SZ_2M, SZ_8M)); in memblock_overlaps_region_check()
2417 ASSERT_TRUE(memblock_overlaps_region(&memblock.memory, SZ_1G + SZ_1M, SZ_1M)); in memblock_overlaps_region_check()