@@ -303,12 +303,12 @@ static int memblock_add_checks(void)
303
303
return 0 ;
304
304
}
305
305
306
- /*
307
- * A simple test that marks a memory block of a specified base address
308
- * and size as reserved and to the collection of reserved memory regions
309
- * (memblock.reserved). It checks if a new entry was created and if region
310
- * counter and total memory size were correctly updated.
311
- */
306
+ /*
307
+ * A simple test that marks a memory block of a specified base address
308
+ * and size as reserved and to the collection of reserved memory regions
309
+ * (memblock.reserved). Expect to create a new entry. The region counter
310
+ * and total memory size are updated.
311
+ */
312
312
static int memblock_reserve_simple_check (void )
313
313
{
314
314
struct memblock_region * rgn ;
@@ -330,10 +330,15 @@ static int memblock_reserve_simple_check(void)
330
330
}
331
331
332
332
/*
333
- * A test that tries to mark two memory blocks that don't overlap as reserved
334
- * and checks if two entries were correctly added to the collection of reserved
335
- * memory regions (memblock.reserved) and if this change was reflected in
336
- * memblock.reserved's total size and region counter.
333
+ * A test that tries to mark two memory blocks that don't overlap as reserved:
334
+ *
335
+ * | +--+ +----------------+ |
336
+ * | |r1| | r2 | |
337
+ * +--------+--+------+----------------+--+
338
+ *
339
+ * Expect to add two entries to the collection of reserved memory regions
340
+ * (memblock.reserved). The total size and region counter for
341
+ * memblock.reserved are updated.
337
342
*/
338
343
static int memblock_reserve_disjoint_check (void )
339
344
{
@@ -368,13 +373,22 @@ static int memblock_reserve_disjoint_check(void)
368
373
}
369
374
370
375
/*
371
- * A test that tries to mark two memory blocks as reserved, where the
372
- * second one overlaps with the beginning of the first (that is
373
- * r1.base < r2.base + r2.size).
374
- * It checks if two entries are merged into one region that starts at r2.base
375
- * and has size of two regions minus their intersection. The test also verifies
376
- * that memblock can still see only one entry and has a correct total size of
377
- * the reserved memory.
376
+ * A test that tries to mark two memory blocks r1 and r2 as reserved,
377
+ * where r2 overlaps with the beginning of r1 (that is
378
+ * r1.base < r2.base + r2.size):
379
+ *
380
+ * | +--------------+--+--------------+ |
381
+ * | | r2 | | r1 | |
382
+ * +--+--------------+--+--------------+--+
383
+ * ^ ^
384
+ * | |
385
+ * | r1.base
386
+ * |
387
+ * r2.base
388
+ *
389
+ * Expect to merge two entries into one region that starts at r2.base and
390
+ * has size of two regions minus their intersection. The total size of the
391
+ * reserved memory is updated, and the region counter is not updated.
378
392
*/
379
393
static int memblock_reserve_overlap_top_check (void )
380
394
{
@@ -408,13 +422,22 @@ static int memblock_reserve_overlap_top_check(void)
408
422
}
409
423
410
424
/*
411
- * A test that tries to mark two memory blocks as reserved, where the
412
- * second one overlaps with the end of the first entry (that is
413
- * r2.base < r1.base + r1.size).
414
- * It checks if two entries are merged into one region that starts at r1.base
415
- * and has size of two regions minus their intersection. It verifies that
416
- * memblock can still see only one entry and has a correct total size of the
417
- * reserved memory.
425
+ * A test that tries to mark two memory blocks r1 and r2 as reserved,
426
+ * where r2 overlaps with the end of r1 (that is
427
+ * r2.base < r1.base + r1.size):
428
+ *
429
+ * | +--------------+--+--------------+ |
430
+ * | | r1 | | r2 | |
431
+ * +--+--------------+--+--------------+--+
432
+ * ^ ^
433
+ * | |
434
+ * | r2.base
435
+ * |
436
+ * r1.base
437
+ *
438
+ * Expect to merge two entries into one region that starts at r1.base and
439
+ * has size of two regions minus their intersection. The total size of the
440
+ * reserved memory is updated, and the region counter is not updated.
418
441
*/
419
442
static int memblock_reserve_overlap_bottom_check (void )
420
443
{
@@ -448,12 +471,21 @@ static int memblock_reserve_overlap_bottom_check(void)
448
471
}
449
472
450
473
/*
451
- * A test that tries to mark two memory blocks as reserved, where the second
452
- * one is within the range of the first entry (that is
453
- * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)).
454
- * It checks if two entries are merged into one region that stays the
455
- * same. The counter and total size of available memory are expected to not be
456
- * updated.
474
+ * A test that tries to mark two memory blocks r1 and r2 as reserved,
475
+ * where r2 is within the range of r1 (that is
476
+ * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)):
477
+ *
478
+ * | +-----+--+---------------------------|
479
+ * | | |r2| r1 |
480
+ * +-+-----+--+---------------------------+
481
+ * ^ ^
482
+ * | |
483
+ * | r2.base
484
+ * |
485
+ * r1.base
486
+ *
487
+ * Expect to merge two entries into one region that stays the same. The
488
+ * counter and total size of available memory are not updated.
457
489
*/
458
490
static int memblock_reserve_within_check (void )
459
491
{
@@ -485,7 +517,7 @@ static int memblock_reserve_within_check(void)
485
517
486
518
/*
487
519
* A simple test that tries to reserve the same memory block twice.
488
- * The region counter and total size of reserved memory are expected to not
520
+ * Expect the region counter and total size of reserved memory to not
489
521
* be updated.
490
522
*/
491
523
static int memblock_reserve_twice_check (void )
0 commit comments