From patchwork Fri Apr 22 12:55:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12823393 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 180BAC433EF for ; Fri, 22 Apr 2022 12:55:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A56436B0078; Fri, 22 Apr 2022 08:55:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A04356B007B; Fri, 22 Apr 2022 08:55:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A56B6B007D; Fri, 22 Apr 2022 08:55:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 7B2B76B0078 for ; Fri, 22 Apr 2022 08:55:52 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 4EFFF8037D for ; Fri, 22 Apr 2022 12:55:52 +0000 (UTC) X-FDA: 79384512144.28.72F1E29 Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by imf07.hostedemail.com (Postfix) with ESMTP id 27F6540030 for ; Fri, 22 Apr 2022 12:55:50 +0000 (UTC) Received: by mail-oi1-f194.google.com with SMTP id a10so8916294oif.9 for ; Fri, 22 Apr 2022 05:55:51 -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=SSzBkjMJuCHeJx2Pu4aS83z4goHTE74keZ/qqMMfuhA=; b=MqqUxOS6UYkQBMFgU7FZuYpCZrExwg+iIEuziM/4qa29/1zOq6WslvELA3HQS0ejgx Au1NoV8rU4pBBlnQA3p1ZibeVPdfn40tJjopUi2IhCGJsKorWv4TF4fLYUYuevob2sN6 zWK7HLwR2gz+7kFqxQXS+xccqQNQ15lVf28X4gdj3o4xLJOmTL4MecUqHXqvi7YCGxt3 9w9h+7VBe95DPAsjdJlhIe+R3IEYgQvCF80HJnTGOU3nrdpP67/FbVZpR8VTRmkpSZD5 HGigzSQmSsXUd8QB6Mhg5A1UcBgICaX2aOrVnz7uIQSEhBn1GvyfAUAciLBiZx1CypCW XwVA== 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=SSzBkjMJuCHeJx2Pu4aS83z4goHTE74keZ/qqMMfuhA=; b=MmoS6ObT2/fLjFHmCrwujPx+yV6Q61ZIMl+7Gi5KVON5YpDLEU4AC4MJho+kFxWkaB AEe9J9GOVAO28oXQ+Eg+XPKynr+ALER7g3IeX7w4kDTL3xIYpdtKdXJMg2E0mK4S5fa4 1HHD0ZAAglXI6gBk8c4mTaYUo8pIOBNWMvIPKW0XttjP81lKL1NBt6W6FQ8p9JBxKbdj LVp1u065Qnc5bOBwvW6GOpzAcV5p+1K5NNOEj9x6oH9mQR36A9xeoAnbL5cj38r5PPE7 idf7JlyPHqX3BGKh4k3/mV7K6W6cd0eAL8xhfP3wBCDYVw/lXr2uMY+RSf8szTUcThbx xvJg== X-Gm-Message-State: AOAM532tc1MBh6bOWEd/7xvjz8eaZWgGZqHnheU94LGmiFWx3BW6NBqQ ysPa3Z3mbV0PJqOwpgFoOPQ= X-Google-Smtp-Source: ABdhPJwEZILKUBLVPKo5TtyKFNvR3mT7Dbgr+qteZauIsUxypI1YzklO3lV25m56prRuZdBLh8baOQ== X-Received: by 2002:a05:6808:14d4:b0:323:652:9302 with SMTP id f20-20020a05680814d400b0032306529302mr4192401oiw.105.1650632150926; Fri, 22 Apr 2022 05:55:50 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id 64-20020aca0643000000b002f9b8a6ca98sm732174oig.4.2022.04.22.05.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 05:55:50 -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 v2 1/4] memblock tests: update style of comments for memblock_add_*() functions Date: Fri, 22 Apr 2022 07:55:35 -0500 Message-Id: <2ea997e7b5c4737d674a2e5d9288938d557cb0c3.1650631746.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MqqUxOS6; spf=pass (imf07.hostedemail.com: domain of remckee0@gmail.com designates 209.85.167.194 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: 3sgaia45niu94m1zfyfkpqzkzezzcorf X-Rspamd-Queue-Id: 27F6540030 X-Rspamd-Server: rspam04 X-Rspam-User: X-HE-Tag: 1650632150-523476 X-Bogosity: Ham, tests=bogofilter, spamicity=0.006174, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update comments in memblock_add_*() 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. Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/basic_api.c | 77 +++++++++++++++++------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index fbc1ce160303..e96be0319ad4 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -26,8 +26,8 @@ static int memblock_initialization_check(void) /* * A simple test that adds a memory block of a specified base address * and size to the collection of available memory regions (memblock.memory). - * It checks if a new entry was created and if region counter and total memory - * were correctly updated. + * Expect to create a new entry. The region counter and total memory get + * updated. */ static int memblock_add_simple_check(void) { @@ -53,10 +53,10 @@ static int memblock_add_simple_check(void) } /* - * A simple test that adds a memory block of a specified base address, size + * A simple test that adds a memory block of a specified base address, size, * NUMA node and memory flags to the collection of available memory regions. - * It checks if the new entry, region counter and total memory size have - * expected values. + * Expect to create a new entry. The region counter and total memory get + * updated. */ static int memblock_add_node_simple_check(void) { @@ -87,9 +87,15 @@ static int memblock_add_node_simple_check(void) /* * A test that tries to add two memory blocks that don't overlap with one - * another. It checks if two correctly initialized entries were added to the - * collection of available memory regions (memblock.memory) and if this - * change was reflected in memblock.memory's total size and region counter. + * another: + * + * | +--------+ +--------+ | + * | | r1 | | r2 | | + * +--------+--------+--------+--------+--+ + * + * Expect to add two correctly initialized entries to the collection of + * available memory regions (memblock.memory). The total size and + * region counter fields get updated. */ static int memblock_add_disjoint_check(void) { @@ -125,10 +131,20 @@ static int memblock_add_disjoint_check(void) /* * A test that tries to add two memory blocks, where the second one overlaps - * with the beginning of the first entry (that is r1.base < r2.base + r2.size). - * After this, it checks if two entries are merged into one region that starts - * at r2.base and has size of two regions minus their intersection. It also - * verifies the reported total size of the available memory and region counter. + * with the beginning of the first entry (that is r1.base < r2.base + r2.size): + * + * | +----+----+------------+ | + * | | |r2 | r1 | | + * +----+----+----+------------+----------+ + * ^ ^ + * | | + * | r1.base + * | + * r2.base + * + * Expect to merge the two entries into one region that starts at r2.base + * and has size of two regions minus their intersection. The total size of + * the available memory is updated, and the region counter stays the same. */ static int memblock_add_overlap_top_check(void) { @@ -163,11 +179,20 @@ static int memblock_add_overlap_top_check(void) /* * A test that tries to add two memory blocks, where the second one overlaps - * with the end of the first entry (that is r2.base < r1.base + r1.size). - * After this, it checks if two entries are merged into one region that starts - * at r1.base and has size of two regions minus their intersection. It verifies - * that memblock can still see only one entry and has a correct total size of - * the available memory. + * with the end of the first entry (that is r2.base < r1.base + r1.size): + * + * | +--+------+----------+ | + * | | | r1 | r2 | | + * +--+--+------+----------+--------------+ + * ^ ^ + * | | + * | r2.base + * | + * r1.base + * + * Expect to merge the two entries into one region that starts at r1.base + * and has size of two regions minus their intersection. The total size of + * the available memory is updated, and the region counter stays the same. */ static int memblock_add_overlap_bottom_check(void) { @@ -203,9 +228,17 @@ static int memblock_add_overlap_bottom_check(void) /* * A test that tries to add two memory blocks, where the second one is * within the range of the first entry (that is r1.base < r2.base && - * r2.base + r2.size < r1.base + r1.size). It checks if two entries are merged - * into one region that stays the same. The counter and total size of available - * memory are expected to not be updated. + * r2.base + r2.size < r1.base + r1.size): + * + * | +-------+--+-----------------------+ + * | | |r2| r1 | + * +---+-------+--+-----------------------+ + * ^ + * | + * r1.base + * + * Expect to merge two entries into one region that stays the same. + * The counter and total size of available memory are not updated. */ static int memblock_add_within_check(void) { @@ -236,8 +269,8 @@ static int memblock_add_within_check(void) } /* - * A simple test that tries to add the same memory block twice. The counter - * and total size of available memory are expected to not be updated. + * A simple test that tries to add the same memory block twice. Expect + * the counter and total size of available memory to not be updated. */ static int memblock_add_twice_check(void) {