From patchwork Fri Apr 22 13:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12823433 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13E63C433EF for ; Fri, 22 Apr 2022 13:33:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B6806B007D; Fri, 22 Apr 2022 09:33:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 918306B007E; Fri, 22 Apr 2022 09:33:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 793DC6B0080; Fri, 22 Apr 2022 09:33:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 61B496B007D for ; Fri, 22 Apr 2022 09:33:25 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 386CB205D9 for ; Fri, 22 Apr 2022 13:33:25 +0000 (UTC) X-FDA: 79384606770.12.97C266A Received: from mail-oo1-f68.google.com (mail-oo1-f68.google.com [209.85.161.68]) by imf30.hostedemail.com (Postfix) with ESMTP id 4C74F80031 for ; Fri, 22 Apr 2022 13:33:21 +0000 (UTC) Received: by mail-oo1-f68.google.com with SMTP id x22-20020a4aca96000000b00338fbaf797bso1404391ooq.10 for ; Fri, 22 Apr 2022 06:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tNoQl+sfpyAeueHKt3p64baur4SRIlT3Mj6rERAMI1U=; b=ZkZJH8DeJTV2QEF/sLGsBvw72C6OMsR+FICTZFvE7+T0kIjcKfM/AIiu/2y+GLDwbx igQ+D//IoSZCQsdhRTJHMcoMC0K64EiDvTREklRTVFJWHze/rAOPq8XzP+bQFz/scUDe D2+I34OCJPRgg6TG0RMs8Qy5ysy1AnHz7KuFXzTS52CYdkT2pgX32F1f22XM3SaE5GRJ v8zjKTTWXPZPrBFG4SMPCAPw3DDvm0NayjBpoTvzKTYyqqBt8dVmk+WzD/8GjwWPfqo3 N1a23ieOTECnnDQcv09Dj6vtz0jnPdn/icxvv8n134KDhfdMOoFWoYI3fiXzI5bwPTpJ ZdTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tNoQl+sfpyAeueHKt3p64baur4SRIlT3Mj6rERAMI1U=; b=Mv/OAQM0ciiqKuT9qtcIjWUUk0h1AlymlSbvnMTjSE+vXeUuVJHuXoANJxMi9GObPf DEYTCDz/ZpZK3UCCzd8gi7meEmwLdp3NdExxqgyAaFskz3W7yXZW43N/XCEmV7HA0jZD RoyNv32R2ANUSubqjcPg8ZjUa/tTXEsjxe8PEsFSFN5GAF6zoeBPHloZs9CmB7quy2gt P7aitDesoaBtYzhIzqzewEBiPsRDz6YWJv1LPFGNMbxlipldWitKIC07+7sOW1e4YBqi Lv5AAndzCL5VXsjTidoHGwfrGdqsQ7ounrHK623VqH/EF+eKXR9VVqerJwLWPzoOa7dT kHiQ== X-Gm-Message-State: AOAM532iTEYgFpTErls4E2G5Qa2EKKhfUi4KJgIt67A4UCRRQOvqd8g0 5G4U73X7jUmva604hCPXAzQ= X-Google-Smtp-Source: ABdhPJxSU/zThx4wKmESf3C+FPCzLNZeY1V1RBDCVU/BjmOt+fWcoMfXS/9QAM9GK9EneSJf+MrSPA== X-Received: by 2002:a4a:968e:0:b0:324:22c6:1a31 with SMTP id s14-20020a4a968e000000b0032422c61a31mr1553415ooi.93.1650634403983; Fri, 22 Apr 2022 06:33:23 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id c25-20020a0568301af900b0060579b0abe2sm708887otd.61.2022.04.22.06.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:33:23 -0700 (PDT) From: Rebecca Mckeever To: outreachy@lists.linux.dev Cc: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Rebecca Mckeever Subject: [PATCH v3 4/5] memblock tests: update style of comments for memblock_free_*() functions Date: Fri, 22 Apr 2022 08:33:01 -0500 Message-Id: <4952e3dce1147685a7ad0ae41287348e9e3f7f68.1650633253.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4C74F80031 X-Stat-Signature: d5hprqxs4gop8xk9xpd8mnif8zfuanuj Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZkZJH8De; spf=pass (imf30.hostedemail.com: domain of remckee0@gmail.com designates 209.85.161.68 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1650634401-84180 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update comments in memblock_free_*() functions to match the style used in tests/alloc_*.c by rewording to make the expected outcome more apparent and, if more than one memblock is involved, adding a visual of the memory blocks. If the comment has an extra column of spaces, remove the extra space at the beginning of each line for consistency and to conform to Linux kernel coding style. Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/basic_api.c | 90 ++++++++++++++++++------ 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 08847dc5065e..f646350d370e 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -806,10 +806,17 @@ static int memblock_remove_checks(void) /* * A simple test that tries to free a memory block that was marked earlier * as reserved. By "freeing" a region we mean overwriting it with the next - * entry in memblock.reserved. To check this is the case, the test reserves - * two memory regions and verifies that the value of the latter was used to - * erase r1 region. - * The test also checks if the region counter and total size were updated. + * entry in memblock.reserved: + * + * | ...... +----+ | + * | : r1 : | r2 | | + * +--------------+----+-----------+----+-+ + * ^ + * | + * rgn.base + * + * Expect to reserve two memory regions and then erase r1 region with the + * value of r2. The region counter and total size are updated. */ static int memblock_free_simple_check(void) { @@ -840,11 +847,22 @@ static int memblock_free_simple_check(void) return 0; } - /* - * A test that tries to free a region that was not marked as reserved - * (i.e. has no corresponding entry in memblock.reserved). It verifies - * that array, regions counter and total size were not modified. - */ +/* + * A test that tries to free a region that was not marked as reserved + * (i.e. has no corresponding entry in memblock.reserved): + * + * +----------------+ + * | r2 | + * +----------------+ + * | +----+ | + * | | r1 | | + * +--+----+------------------------------+ + * ^ + * | + * rgn.base + * + * The array, regions counter and total size are not modified. + */ static int memblock_free_absent_check(void) { struct memblock_region *rgn; @@ -875,10 +893,22 @@ static int memblock_free_absent_check(void) /* * A test that tries to free a region which overlaps with the beginning of - * the already existing entry r1 (that is r1.base < r2.base + r2.size). It - * checks if only the intersection of both regions is freed. The test also - * checks if the regions counter and total size are updated to expected - * values. + * the already existing entry r1 (that is r1.base < r2.base + r2.size): + * + * +----+ + * | r2 | + * +----+ + * | ...+--------------+ | + * | : | r1 | | + * +----+--+--------------+---------------+ + * ^ ^ + * | | + * | rgn.base + * | + * r1.base + * + * Expect that only the intersection of both regions is freed. The + * regions counter and total size are updated. */ static int memblock_free_overlap_top_check(void) { @@ -913,9 +943,17 @@ static int memblock_free_overlap_top_check(void) /* * A test that tries to free a region which overlaps with the end of the - * first entry (that is r2.base < r1.base + r1.size). It checks if only the - * intersection of both regions is freed. The test also checks if the - * regions counter and total size are updated to expected values. + * first entry (that is r2.base < r1.base + r1.size): + * + * +----------------+ + * | r2 | + * +----------------+ + * | +-----------+..... | + * | | r1 | : | + * +----+-----------+----+----------------+ + * + * Expect that only the intersection of both regions is freed. The + * regions counter and total size are updated. */ static int memblock_free_overlap_bottom_check(void) { @@ -951,11 +989,21 @@ static int memblock_free_overlap_bottom_check(void) /* * A test that tries to free a region which is within the range of the * already existing entry (that is - * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)). - * It checks if the region is split into two - one that ends at r2.base and - * second that starts at r2.base + size, with appropriate sizes. It is - * expected that the region counter and total size fields were updated t - * reflect that change. + * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)): + * + * +----+ + * | r2 | + * +----+ + * | +------------+....+---------------+ + * | | rgn1 | r1 | rgn2 | + * +----+------------+----+---------------+ + * ^ + * | + * r1.base + * + * Expect that the region is split into two - one that ends at r2.base and + * another that starts at r2.base + size, with appropriate sizes. The + * region counter and total size fields are updated. */ static int memblock_free_within_check(void) {