From patchwork Sat Apr 30 22:49:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12833451 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 641EAC433F5 for ; Sat, 30 Apr 2022 22:50:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E79696B0078; Sat, 30 Apr 2022 18:50:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E28FE6B007B; Sat, 30 Apr 2022 18:50:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA4546B007D; Sat, 30 Apr 2022 18:50:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id BA0356B0078 for ; Sat, 30 Apr 2022 18:50:01 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 91B9980BED for ; Sat, 30 Apr 2022 22:50:01 +0000 (UTC) X-FDA: 79415039802.03.CE73BF5 Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf12.hostedemail.com (Postfix) with ESMTP id 8CE554003A for ; Sat, 30 Apr 2022 22:49:48 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id s12-20020a0568301e0c00b00605f30530c2so3683535otr.9 for ; Sat, 30 Apr 2022 15:50:00 -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=9HLWFM+tx2KwN5HOVNTRmgPm5n3Gwj/LoS/zXb/aBvk=; b=L/t3SMdiq0R8WE60sg4aJiN6cEG5iQI0zdwEZsZsT0FYi8peSasDMq0FnerMLj0Tnj /xJKAGrj6rANvcm3TVT7OVUmw5tiuZCUbhjMI+P6DK8DImEdR8M9/w6A1PFnVsBiFRRX KvkMBzmx2TK6Q7A5JBHd7t/qwh3oElxb18USZAenH/sUV5Gl4Sgut4W55nntSXx5tpVM lKTMV+/oGDy4adkTteeixwPHJQO+cojcDLBpb13BgRmgz/TY64ct3hVxsF/9rR6ir4Nx hosgnaOpvVM5L+c6Yjdo9JMZ4jXYSlyR9FMbgbJmthkSP9xasiybesp1UssF0Qv0gBMu 6KsA== 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=9HLWFM+tx2KwN5HOVNTRmgPm5n3Gwj/LoS/zXb/aBvk=; b=f1EAj/piRTtHhJaFqdrUI0V5mnsyeUFSIg/XVxZzEHQkuApny08XstC/LGf/xciKmC HMPOM49q6Ylbxe3DTsMaQVtihQalRMW41vg8jHZrloEID/oda7+C6zBsTmgm+ID8ty6A U3wgu2Mld10UByKCdN24S8VLV/eleq50pOPaRKYGesgkHpZbtIaSRNRVzwDIWttIix0v K/zqXmST/jyGPl0QrWckydLu0DBpSCU/Q9TLfETJDC1rCkyTb9bCqqfoWDigEWTwBfr9 KqpChrvpo8C3HNcD9IuhiZhTiPAEj1Hwiv25yGzpRRv/FbT3bgYDqAT/WkOL3fxqJMpz aCEQ== X-Gm-Message-State: AOAM530bIKq3wve6JibLWG9WufGsa4l70IWENG/SkRM+/FZNqk/thhAd 8piD4c+ZkzS36YNGPYm95j4= X-Google-Smtp-Source: ABdhPJzz4ZyfwMqmDCjlmro6vvBy4B59tHcAdE+lyX61Oxu7SxwE0PSIYZaFk7+JfwZJOrIbl5wyyQ== X-Received: by 2002:a9d:5a19:0:b0:5cd:9ca0:898b with SMTP id v25-20020a9d5a19000000b005cd9ca0898bmr2073134oth.318.1651359000508; Sat, 30 Apr 2022 15:50:00 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id q4-20020a056870028400b000e5aa7f2cadsm4418993oaf.3.2022.04.30.15.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 15:50:00 -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 v4 4/5] memblock tests: update style of comments for memblock_free_*() functions Date: Sat, 30 Apr 2022 17:49:39 -0500 Message-Id: <9256c86a6be96e5270670b3cd8a17ec2593646c9.1651357434.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8CE554003A X-Stat-Signature: tzd4h5i4bp84aaq94uwhnh4siqo6ya3e Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="L/t3SMdi"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of remckee0@gmail.com designates 209.85.210.65 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-HE-Tag: 1651358988-931571 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 | 102 +++++++++++++++++------ 1 file changed, 75 insertions(+), 27 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 37b7cc075b0f..a7bc180316d6 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -806,12 +806,19 @@ 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. + * A simple test that tries to free a memory block r1 that was marked + * earlier as reserved. By "freeing" a region we mean overwriting it with + * the next entry r2 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) { @@ -842,11 +849,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 r2 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; @@ -876,11 +894,23 @@ 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. + * A test that tries to free a region r2 that overlaps with the beginning + * of 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) { @@ -914,10 +944,18 @@ 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. + * A test that tries to free a region r2 that overlaps with the end of + * the already existing entry r1 (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,13 +989,23 @@ 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. + * A test that tries to free a region r2 that is within the range of the + * already existing entry r1 (that is + * (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 + r2.size, with appropriate sizes. The + * region counter and total size fields are updated. */ static int memblock_free_within_check(void) {