@@ -806,12 +806,19 @@ static int memblock_remove_checks(void)
806806}
807807
808808/*
809- * A simple test that tries to free a memory block that was marked earlier
810- * as reserved. By "freeing" a region we mean overwriting it with the next
811- * entry in memblock.reserved. To check this is the case, the test reserves
812- * two memory regions and verifies that the value of the latter was used to
813- * erase r1 region.
814- * The test also checks if the region counter and total size were updated.
809+ * A simple test that tries to free a memory block r1 that was marked
810+ * earlier as reserved. By "freeing" a region we mean overwriting it with
811+ * the next entry r2 in memblock.reserved:
812+ *
813+ * | ...... +----+ |
814+ * | : r1 : | r2 | |
815+ * +--------------+----+-----------+----+-+
816+ * ^
817+ * |
818+ * rgn.base
819+ *
820+ * Expect to reserve two memory regions and then erase r1 region with the
821+ * value of r2. The region counter and total size are updated.
815822 */
816823static int memblock_free_simple_check (void )
817824{
@@ -842,11 +849,22 @@ static int memblock_free_simple_check(void)
842849 return 0 ;
843850}
844851
845- /*
846- * A test that tries to free a region that was not marked as reserved
847- * (i.e. has no corresponding entry in memblock.reserved). It verifies
848- * that array, regions counter and total size were not modified.
849- */
852+ /*
853+ * A test that tries to free a region r2 that was not marked as reserved
854+ * (i.e. has no corresponding entry in memblock.reserved):
855+ *
856+ * +----------------+
857+ * | r2 |
858+ * +----------------+
859+ * | +----+ |
860+ * | | r1 | |
861+ * +--+----+------------------------------+
862+ * ^
863+ * |
864+ * rgn.base
865+ *
866+ * The array, regions counter and total size are not modified.
867+ */
850868static int memblock_free_absent_check (void )
851869{
852870 struct memblock_region * rgn ;
@@ -876,11 +894,23 @@ static int memblock_free_absent_check(void)
876894}
877895
878896/*
879- * A test that tries to free a region which overlaps with the beginning of
880- * the already existing entry r1 (that is r1.base < r2.base + r2.size). It
881- * checks if only the intersection of both regions is freed. The test also
882- * checks if the regions counter and total size are updated to expected
883- * values.
897+ * A test that tries to free a region r2 that overlaps with the beginning
898+ * of the already existing entry r1 (that is r1.base < r2.base + r2.size):
899+ *
900+ * +----+
901+ * | r2 |
902+ * +----+
903+ * | ...+--------------+ |
904+ * | : | r1 | |
905+ * +----+--+--------------+---------------+
906+ * ^ ^
907+ * | |
908+ * | rgn.base
909+ * |
910+ * r1.base
911+ *
912+ * Expect that only the intersection of both regions is freed. The
913+ * regions counter and total size are updated.
884914 */
885915static int memblock_free_overlap_top_check (void )
886916{
@@ -914,10 +944,18 @@ static int memblock_free_overlap_top_check(void)
914944}
915945
916946/*
917- * A test that tries to free a region which overlaps with the end of the
918- * first entry (that is r2.base < r1.base + r1.size). It checks if only the
919- * intersection of both regions is freed. The test also checks if the
920- * regions counter and total size are updated to expected values.
947+ * A test that tries to free a region r2 that overlaps with the end of
948+ * the already existing entry r1 (that is r2.base < r1.base + r1.size):
949+ *
950+ * +----------------+
951+ * | r2 |
952+ * +----------------+
953+ * | +-----------+..... |
954+ * | | r1 | : |
955+ * +----+-----------+----+----------------+
956+ *
957+ * Expect that only the intersection of both regions is freed. The
958+ * regions counter and total size are updated.
921959 */
922960static int memblock_free_overlap_bottom_check (void )
923961{
@@ -951,13 +989,23 @@ static int memblock_free_overlap_bottom_check(void)
951989}
952990
953991/*
954- * A test that tries to free a region which is within the range of the
955- * already existing entry (that is
956- * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)).
957- * It checks if the region is split into two - one that ends at r2.base and
958- * second that starts at r2.base + size, with appropriate sizes. It is
959- * expected that the region counter and total size fields were updated t
960- * reflect that change.
992+ * A test that tries to free a region r2 that is within the range of the
993+ * already existing entry r1 (that is
994+ * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)):
995+ *
996+ * +----+
997+ * | r2 |
998+ * +----+
999+ * | +------------+....+---------------+
1000+ * | | rgn1 | r1 | rgn2 |
1001+ * +----+------------+----+---------------+
1002+ * ^
1003+ * |
1004+ * r1.base
1005+ *
1006+ * Expect that the region is split into two - one that ends at r2.base and
1007+ * another that starts at r2.base + r2.size, with appropriate sizes. The
1008+ * region counter and total size fields are updated.
9611009 */
9621010static int memblock_free_within_check (void )
9631011{
0 commit comments