@@ -550,14 +550,22 @@ static int memblock_reserve_checks(void)
550
550
return 0 ;
551
551
}
552
552
553
- /*
554
- * A simple test that tries to remove the first entry of the array of
555
- * available memory regions. By "removing" a region we mean overwriting it
556
- * with the next region in memblock.memory. To check this is the case, the
557
- * test adds two memory blocks and verifies that the value of the latter
558
- * was used to erase r1 region. It also checks if the region counter and
559
- * total size were updated to expected values.
560
- */
553
+ /*
554
+ * A simple test that tries to remove a region r1 from the array of
555
+ * available memory regions. By "removing" a region we mean overwriting it
556
+ * with the next region r2 in memblock.memory:
557
+ *
558
+ * | ...... +----------------+ |
559
+ * | : r1 : | r2 | |
560
+ * +--+----+----------+----------------+--+
561
+ * ^
562
+ * |
563
+ * rgn.base
564
+ *
565
+ * Expect to add two memory blocks r1 and r2 and then remove r1 so that
566
+ * r2 is the first available region. The region counter and total size
567
+ * are updated.
568
+ */
561
569
static int memblock_remove_simple_check (void )
562
570
{
563
571
struct memblock_region * rgn ;
@@ -587,11 +595,22 @@ static int memblock_remove_simple_check(void)
587
595
return 0 ;
588
596
}
589
597
590
- /*
591
- * A test that tries to remove a region that was not registered as available
592
- * memory (i.e. has no corresponding entry in memblock.memory). It verifies
593
- * that array, regions counter and total size were not modified.
594
- */
598
+ /*
599
+ * A test that tries to remove a region r2 that was not registered as
600
+ * available memory (i.e. has no corresponding entry in memblock.memory):
601
+ *
602
+ * +----------------+
603
+ * | r2 |
604
+ * +----------------+
605
+ * | +----+ |
606
+ * | | r1 | |
607
+ * +--+----+------------------------------+
608
+ * ^
609
+ * |
610
+ * rgn.base
611
+ *
612
+ * Expect the array, regions counter and total size to not be modified.
613
+ */
595
614
static int memblock_remove_absent_check (void )
596
615
{
597
616
struct memblock_region * rgn ;
@@ -621,11 +640,23 @@ static int memblock_remove_absent_check(void)
621
640
}
622
641
623
642
/*
624
- * A test that tries to remove a region which overlaps with the beginning of
625
- * the already existing entry r1 (that is r1.base < r2.base + r2.size). It
626
- * checks if only the intersection of both regions is removed from the available
627
- * memory pool. The test also checks if the regions counter and total size are
628
- * updated to expected values.
643
+ * A test that tries to remove a region r2 that overlaps with the
644
+ * beginning of the already existing entry r1
645
+ * (that is r1.base < r2.base + r2.size):
646
+ *
647
+ * +-----------------+
648
+ * | r2 |
649
+ * +-----------------+
650
+ * | .........+--------+ |
651
+ * | : r1 | rgn | |
652
+ * +-----------------+--------+--------+--+
653
+ * ^ ^
654
+ * | |
655
+ * | rgn.base
656
+ * r1.base
657
+ *
658
+ * Expect that only the intersection of both regions is removed from the
659
+ * available memory pool. The regions counter and total size are updated.
629
660
*/
630
661
static int memblock_remove_overlap_top_check (void )
631
662
{
@@ -661,11 +692,21 @@ static int memblock_remove_overlap_top_check(void)
661
692
}
662
693
663
694
/*
664
- * A test that tries to remove a region which overlaps with the end of the
665
- * first entry (that is r2.base < r1.base + r1.size). It checks if only the
666
- * intersection of both regions is removed from the available memory pool.
667
- * The test also checks if the regions counter and total size are updated to
668
- * expected values.
695
+ * A test that tries to remove a region r2 that overlaps with the end of
696
+ * the already existing region r1 (that is r2.base < r1.base + r1.size):
697
+ *
698
+ * +--------------------------------+
699
+ * | r2 |
700
+ * +--------------------------------+
701
+ * | +---+..... |
702
+ * | |rgn| r1 : |
703
+ * +-+---+----+---------------------------+
704
+ * ^
705
+ * |
706
+ * r1.base
707
+ *
708
+ * Expect that only the intersection of both regions is removed from the
709
+ * available memory pool. The regions counter and total size are updated.
669
710
*/
670
711
static int memblock_remove_overlap_bottom_check (void )
671
712
{
@@ -698,13 +739,23 @@ static int memblock_remove_overlap_bottom_check(void)
698
739
}
699
740
700
741
/*
701
- * A test that tries to remove a region which is within the range of the
702
- * already existing entry (that is
703
- * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)).
704
- * It checks if the region is split into two - one that ends at r2.base and
705
- * second that starts at r2.base + size, with appropriate sizes. The test
706
- * also checks if the region counter and total size were updated to
707
- * expected values.
742
+ * A test that tries to remove a region r2 that is within the range of
743
+ * the already existing entry r1 (that is
744
+ * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)):
745
+ *
746
+ * +----+
747
+ * | r2 |
748
+ * +----+
749
+ * | +-------------+....+---------------+ |
750
+ * | | rgn1 | r1 | rgn2 | |
751
+ * +-+-------------+----+---------------+-+
752
+ * ^
753
+ * |
754
+ * r1.base
755
+ *
756
+ * Expect that the region is split into two - one that ends at r2.base and
757
+ * another that starts at r2.base + r2.size, with appropriate sizes. The
758
+ * region counter and total size are updated.
708
759
*/
709
760
static int memblock_remove_within_check (void )
710
761
{
0 commit comments