Lines Matching refs:memory
17 ASSERT_NE(memblock.memory.regions, NULL);
18 ASSERT_EQ(memblock.memory.cnt, 1);
19 ASSERT_EQ(memblock.memory.max, EXPECTED_MEMBLOCK_REGIONS);
20 ASSERT_EQ(strcmp(memblock.memory.name, "memory"), 0);
24 ASSERT_EQ(memblock.memory.max, EXPECTED_MEMBLOCK_REGIONS);
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];
60 ASSERT_EQ(memblock.memory.cnt, 1);
61 ASSERT_EQ(memblock.memory.total_size, r.size);
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];
97 ASSERT_EQ(memblock.memory.cnt, 1);
98 ASSERT_EQ(memblock.memory.total_size, r.size);
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];
122 rgn2 = &memblock.memory.regions[1];
145 ASSERT_EQ(memblock.memory.cnt, 2);
146 ASSERT_EQ(memblock.memory.total_size, r1.size + r2.size);
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];
197 ASSERT_EQ(memblock.memory.cnt, 1);
198 ASSERT_EQ(memblock.memory.total_size, total_size);
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];
249 ASSERT_EQ(memblock.memory.cnt, 1);
250 ASSERT_EQ(memblock.memory.total_size, total_size);
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];
296 ASSERT_EQ(memblock.memory.cnt, 1);
297 ASSERT_EQ(memblock.memory.total_size, r1.size);
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);
323 ASSERT_EQ(memblock.memory.total_size, r.size);
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];
374 ASSERT_EQ(memblock.memory.cnt, 1);
375 ASSERT_EQ(memblock.memory.total_size, total_size);
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];
418 ASSERT_EQ(memblock.memory.cnt, 1);
419 ASSERT_EQ(memblock.memory.total_size, total_size);
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
452 * split it into small block. First we split a large enough memory block
453 * as the memory region which will be choosed by memblock_double_array().
460 /* This is the base of small memory block. */
463 orig_region = memblock.memory.regions;
468 * gap between the nearby memory to avoid being merged.
473 ASSERT_EQ(memblock.memory.cnt, i + 2);
474 ASSERT_EQ(memblock.memory.total_size, new_memory_regions_size +
480 * update the memory.max.
482 ASSERT_EQ(memblock.memory.max, INIT_MEMBLOCK_REGIONS * 2);
484 /* memblock_double_array() will reserve the memory it used. Check it. */
493 ASSERT_EQ(memblock.memory.regions[0].base, r.base);
494 ASSERT_EQ(memblock.memory.regions[0].size, r.size);
496 ASSERT_EQ(memblock.memory.cnt, INIT_MEMBLOCK_REGIONS + 2);
497 ASSERT_EQ(memblock.memory.total_size, INIT_MEMBLOCK_REGIONS * size +
500 ASSERT_EQ(memblock.memory.max, INIT_MEMBLOCK_REGIONS * 2);
505 * The current memory.regions is occupying a range of memory that
506 * allocated from dummy_physical_memory_init(). After free the memory,
507 * we must not use it. So restore the origin memory region to make sure
510 memblock.memory.regions = orig_region;
511 memblock.memory.cnt = INIT_MEMBLOCK_REGIONS;
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(). */
922 /* Reserve some fakes memory region to fulfill the memblock. */
928 /* Keep the gap so these memory region will not be merged. */
938 * This is the memory region size used by the doubled reserved.regions,
945 * The double_array() will find a free memory region as the new
946 * reserved.regions, and the used memory region will be reserved, so
972 * The current reserved.regions is occupying a range of memory that
973 * allocated from dummy_physical_memory_init(). After free the memory,
974 * we must not use it. So restore the origin memory region to make sure
1008 * available memory regions. By "removing" a region we mean overwriting it
1009 * with the next region r2 in memblock.memory:
1018 * Expect to add two memory blocks r1 and r2 and then remove r1 so that
1026 rgn = &memblock.memory.regions[0];
1047 ASSERT_EQ(memblock.memory.cnt, 1);
1048 ASSERT_EQ(memblock.memory.total_size, r2.size);
1057 * available memory (i.e. has no corresponding entry in memblock.memory):
1075 rgn = &memblock.memory.regions[0];
1095 ASSERT_EQ(memblock.memory.cnt, 1);
1096 ASSERT_EQ(memblock.memory.total_size, r1.size);
1120 * available memory pool. The regions counter and total size are updated.
1127 rgn = &memblock.memory.regions[0];
1151 ASSERT_EQ(memblock.memory.cnt, 1);
1152 ASSERT_EQ(memblock.memory.total_size, total_size);
1174 * available memory pool. The regions counter and total size are updated.
1181 rgn = &memblock.memory.regions[0];
1203 ASSERT_EQ(memblock.memory.cnt, 1);
1204 ASSERT_EQ(memblock.memory.total_size, total_size);
1235 rgn1 = &memblock.memory.regions[0];
1236 rgn2 = &memblock.memory.regions[1];
1263 ASSERT_EQ(memblock.memory.cnt, 2);
1264 ASSERT_EQ(memblock.memory.total_size, total_size);
1273 * available memory regions when r1 is the only available region.
1274 * Expect to add a memory block r1 and then remove r1 so that a dummy
1282 rgn = &memblock.memory.regions[0];
1298 ASSERT_EQ(memblock.memory.cnt, 1);
1299 ASSERT_EQ(memblock.memory.total_size, 0);
1308 * memory regions when r2 extends past PHYS_ADDR_MAX:
1318 * Expect the total size of available memory to be updated and the counter to
1326 rgn = &memblock.memory.regions[0];
1349 ASSERT_EQ(memblock.memory.cnt, 1);
1350 ASSERT_EQ(memblock.memory.total_size, total_size);
1369 * from the available memory pool. Expect the total size of available memory to
1377 rgn1 = &memblock.memory.regions[0];
1378 rgn2 = &memblock.memory.regions[1];
1412 ASSERT_EQ(memblock.memory.cnt, 2);
1413 ASSERT_EQ(memblock.memory.total_size, total_size);
1441 * A simple test that tries to free a memory block r1 that was marked
1452 * Expect to reserve two memory regions and then erase r1 region with the
1700 * A simple test that tries to free a memory block r1 that was marked
1702 * Expect to reserve a memory block r1 and then free r1 so that r1 is
1745 * Expect the total size of reserved memory to be updated and the counter to
1796 * from the collection of reserved memory. Expect the total size of reserved
1797 * memory to be updated and the counter to not be updated.
1912 * A test that tries to trim memory when both ends of the memory region are
1913 * aligned. Expect that the memory will not be trimmed. Expect the counter to
1921 rgn = &memblock.memory.regions[0];
1937 ASSERT_EQ(memblock.memory.cnt, 1);
1945 * A test that tries to trim memory when there are two available regions, r1 and
1967 rgn = &memblock.memory.regions[0];
1988 ASSERT_EQ(memblock.memory.cnt, 1);
1996 * A test that tries to trim memory when there are two available regions, r1 and
2021 rgn1 = &memblock.memory.regions[0];
2022 rgn2 = &memblock.memory.regions[1];
2049 ASSERT_EQ(memblock.memory.cnt, 2);
2057 * A test that tries to trim memory when there are two available regions, r1 and
2082 rgn1 = &memblock.memory.regions[0];
2083 rgn2 = &memblock.memory.regions[1];
2109 ASSERT_EQ(memblock.memory.cnt, 2);