@@ -26,8 +26,8 @@ static int memblock_initialization_check(void)
26
26
/*
27
27
* A simple test that adds a memory block of a specified base address
28
28
* and size to the collection of available memory regions (memblock.memory).
29
- * It checks if a new entry was created and if region counter and total memory
30
- * were correctly updated.
29
+ * Expect to create a new entry. The region counter and total memory get
30
+ * updated.
31
31
*/
32
32
static int memblock_add_simple_check (void )
33
33
{
@@ -53,10 +53,10 @@ static int memblock_add_simple_check(void)
53
53
}
54
54
55
55
/*
56
- * A simple test that adds a memory block of a specified base address, size
56
+ * A simple test that adds a memory block of a specified base address, size,
57
57
* NUMA node and memory flags to the collection of available memory regions.
58
- * It checks if the new entry, region counter and total memory size have
59
- * expected values .
58
+ * Expect to create a new entry. The region counter and total memory get
59
+ * updated .
60
60
*/
61
61
static int memblock_add_node_simple_check (void )
62
62
{
@@ -87,9 +87,15 @@ static int memblock_add_node_simple_check(void)
87
87
88
88
/*
89
89
* A test that tries to add two memory blocks that don't overlap with one
90
- * another. It checks if two correctly initialized entries were added to the
91
- * collection of available memory regions (memblock.memory) and if this
92
- * change was reflected in memblock.memory's total size and region counter.
90
+ * another:
91
+ *
92
+ * | +--------+ +--------+ |
93
+ * | | r1 | | r2 | |
94
+ * +--------+--------+--------+--------+--+
95
+ *
96
+ * Expect to add two correctly initialized entries to the collection of
97
+ * available memory regions (memblock.memory). The total size and
98
+ * region counter fields get updated.
93
99
*/
94
100
static int memblock_add_disjoint_check (void )
95
101
{
@@ -124,11 +130,21 @@ static int memblock_add_disjoint_check(void)
124
130
}
125
131
126
132
/*
127
- * A test that tries to add two memory blocks, where the second one overlaps
128
- * with the beginning of the first entry (that is r1.base < r2.base + r2.size).
129
- * After this, it checks if two entries are merged into one region that starts
130
- * at r2.base and has size of two regions minus their intersection. It also
131
- * verifies the reported total size of the available memory and region counter.
133
+ * A test that tries to add two memory blocks r1 and r2, where r2 overlaps
134
+ * with the beginning of r1 (that is r1.base < r2.base + r2.size):
135
+ *
136
+ * | +----+----+------------+ |
137
+ * | | |r2 | r1 | |
138
+ * +----+----+----+------------+----------+
139
+ * ^ ^
140
+ * | |
141
+ * | r1.base
142
+ * |
143
+ * r2.base
144
+ *
145
+ * Expect to merge the two entries into one region that starts at r2.base
146
+ * and has size of two regions minus their intersection. The total size of
147
+ * the available memory is updated, and the region counter stays the same.
132
148
*/
133
149
static int memblock_add_overlap_top_check (void )
134
150
{
@@ -162,12 +178,21 @@ static int memblock_add_overlap_top_check(void)
162
178
}
163
179
164
180
/*
165
- * A test that tries to add two memory blocks, where the second one overlaps
166
- * with the end of the first entry (that is r2.base < r1.base + r1.size).
167
- * After this, it checks if two entries are merged into one region that starts
168
- * at r1.base and has size of two regions minus their intersection. It verifies
169
- * that memblock can still see only one entry and has a correct total size of
170
- * the available memory.
181
+ * A test that tries to add two memory blocks r1 and r2, where r2 overlaps
182
+ * with the end of r1 (that is r2.base < r1.base + r1.size):
183
+ *
184
+ * | +--+------+----------+ |
185
+ * | | | r1 | r2 | |
186
+ * +--+--+------+----------+--------------+
187
+ * ^ ^
188
+ * | |
189
+ * | r2.base
190
+ * |
191
+ * r1.base
192
+ *
193
+ * Expect to merge the two entries into one region that starts at r1.base
194
+ * and has size of two regions minus their intersection. The total size of
195
+ * the available memory is updated, and the region counter stays the same.
171
196
*/
172
197
static int memblock_add_overlap_bottom_check (void )
173
198
{
@@ -201,11 +226,19 @@ static int memblock_add_overlap_bottom_check(void)
201
226
}
202
227
203
228
/*
204
- * A test that tries to add two memory blocks, where the second one is
205
- * within the range of the first entry (that is r1.base < r2.base &&
206
- * r2.base + r2.size < r1.base + r1.size). It checks if two entries are merged
207
- * into one region that stays the same. The counter and total size of available
208
- * memory are expected to not be updated.
229
+ * A test that tries to add two memory blocks r1 and r2, where r2 is
230
+ * within the range of r1 (that is r1.base < r2.base &&
231
+ * r2.base + r2.size < r1.base + r1.size):
232
+ *
233
+ * | +-------+--+-----------------------+
234
+ * | | |r2| r1 |
235
+ * +---+-------+--+-----------------------+
236
+ * ^
237
+ * |
238
+ * r1.base
239
+ *
240
+ * Expect to merge two entries into one region that stays the same.
241
+ * The counter and total size of available memory are not updated.
209
242
*/
210
243
static int memblock_add_within_check (void )
211
244
{
@@ -236,8 +269,8 @@ static int memblock_add_within_check(void)
236
269
}
237
270
238
271
/*
239
- * A simple test that tries to add the same memory block twice. The counter
240
- * and total size of available memory are expected to not be updated.
272
+ * A simple test that tries to add the same memory block twice. Expect
273
+ * the counter and total size of available memory to not be updated.
241
274
*/
242
275
static int memblock_add_twice_check (void )
243
276
{
0 commit comments