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) { From patchwork Fri Apr 22 12:55:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12823394 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 1969EC433EF for ; Fri, 22 Apr 2022 12:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A54D46B007D; Fri, 22 Apr 2022 08:55:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9DDD06B007E; Fri, 22 Apr 2022 08:55:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A5616B0080; Fri, 22 Apr 2022 08:55:55 -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 7B7636B007D for ; Fri, 22 Apr 2022 08:55:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4BAA02034C for ; Fri, 22 Apr 2022 12:55:55 +0000 (UTC) X-FDA: 79384512270.26.79871AC Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by imf18.hostedemail.com (Postfix) with ESMTP id 89CFB1C0027 for ; Fri, 22 Apr 2022 12:55:52 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id r12-20020a056830418c00b006054e1142acso5410765otu.7 for ; Fri, 22 Apr 2022 05:55:54 -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=XlCh/TROTMgIT0UvKXK2lUbRlqfaTVRDW2LmfRt6iMQ=; b=AJbIttGXYKk78W5ujsIsWzkCYa/lf9yqYlUkFmWdh+dOfiIsfjkBqdZvTqeY+FEdHk T4Z1NxZ2ZV3BMxxixFgPNPXVQxlnirDNMuNEvBsD0W/fzqvx2feMd0O5zyk97eoR4aoI pGBS/24bo2SoVROPArN5p5L1yLyjFt5eR/tpzUH4mAXc1Il6rf5b3dUBtFaPq9CGa3r5 E5z3412okDrnVakO8y5zWGp7GO92hBFsX9L13JpwFE72FI3+i7MDnOv6kV+KOt86/e3i b8C4jHR5MPhngq5ZJYeR43obESWWbXPBWqxpgxgIbGMulrJgiiY524PiZbeu5tvvqIu9 32hQ== 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=XlCh/TROTMgIT0UvKXK2lUbRlqfaTVRDW2LmfRt6iMQ=; b=VLggCDhG6sENTv0286gTLP8yVgDW48gsqdWZ207zd6smifm1tZvNW/k0lX5Lk3zUU1 UM2ejr/YUF8AiP8wC3FcFKUSSbF87MAGu6lvag9abJ2GWuGe7n2H7spPs1g7jA9oeQ+C wdEmprk1AiF84bfxdwOKaOSlFv4yiljwKNX6HHnOe+H0Xhz/WcZZ3PHZkHAv4FAYpVdI /YSf034nDxuj6tmXQA+VkuX1mxCmfvbsLXIG4ikAGMWHRZb2zADg965DcO93PqHXexPD RNxVdXtQzY5ugFYCPiz8IceWQtJlIZ41RdlDGDWYpl7NWhVlj/3r7n25oCoJQilIvOgP HIXA== X-Gm-Message-State: AOAM530im3WmfmNV9RTKV51B+1iCI8oVKwZQ3LUazG75n8x5Rtlddcbt GstVOZfc9SlNkarWoyI0CBF38Yc9v4l1mA== X-Google-Smtp-Source: ABdhPJzj3jX9ErrJMhx2HpLiTi18uxQzIahd//wH6r+gPc5CcSmwvCpvIhvJZtoG1Z/cAYKJDOGvUw== X-Received: by 2002:a05:6830:1256:b0:605:4674:d26a with SMTP id s22-20020a056830125600b006054674d26amr1683976otp.245.1650632153327; Fri, 22 Apr 2022 05:55:53 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id ep36-20020a056870a9a400b000de98fe4869sm620837oab.35.2022.04.22.05.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 05:55:52 -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 2/4] memblock tests: update style of comments for memblock_reserve_*() functions Date: Fri, 22 Apr 2022 07:55:36 -0500 Message-Id: <7e21d96491ed573f1f7823cfe56c4d8ced4f78fe.1650631746.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: rspam03 X-Rspamd-Queue-Id: 89CFB1C0027 X-Stat-Signature: 5zhgqeo1n1ptucwxcab6dd4n3wsbpx3e Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=AJbIttGX; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf18.hostedemail.com: domain of remckee0@gmail.com designates 209.85.210.65 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-HE-Tag: 1650632152-594284 X-Bogosity: Ham, tests=bogofilter, spamicity=0.009230, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update comments in memblock_reserve_*() 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 | 82 ++++++++++++++++-------- 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index e96be0319ad4..75cd7479ee54 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -303,12 +303,12 @@ static int memblock_add_checks(void) return 0; } - /* - * A simple test that marks a memory block of a specified base address - * and size as reserved and to the collection of reserved memory regions - * (memblock.reserved). It checks if a new entry was created and if region - * counter and total memory size were correctly updated. - */ +/* + * A simple test that marks a memory block of a specified base address + * and size as reserved and to the collection of reserved memory regions + * (memblock.reserved). Expect to create a new entry. The region counter + * and total memory size are updated. + */ static int memblock_reserve_simple_check(void) { struct memblock_region *rgn; @@ -330,10 +330,15 @@ static int memblock_reserve_simple_check(void) } /* - * A test that tries to mark two memory blocks that don't overlap as reserved - * and checks if two entries were correctly added to the collection of reserved - * memory regions (memblock.reserved) and if this change was reflected in - * memblock.reserved's total size and region counter. + * A test that tries to mark two memory blocks that don't overlap as reserved: + * + * | +--+ +----------------+ | + * | |r1| | r2 | | + * +--------+--+------+----------------+--+ + * + * Expect to add two entries to the collection of reserved memory regions + * (memblock.reserved). The total size and region counter for + * memblock.reserved are updated. */ static int memblock_reserve_disjoint_check(void) { @@ -370,11 +375,20 @@ static int memblock_reserve_disjoint_check(void) /* * A test that tries to mark two memory blocks as reserved, where the * second one overlaps with the beginning of the first (that is - * r1.base < r2.base + r2.size). - * It checks if two entries are merged into one region that starts at r2.base - * and has size of two regions minus their intersection. The test also verifies - * that memblock can still see only one entry and has a correct total size of - * the reserved memory. + * r1.base < r2.base + r2.size): + * + * | +--------------+--+--------------+ | + * | | r2 | | r1 | | + * +--+--------------+--+--------------+--+ + * ^ ^ + * | | + * | r1.base + * | + * r2.base + * + * Expect to merge two entries into one region that starts at r2.base and + * has size of two regions minus their intersection. The total size of the + * reserved memory is updated, and the region counter is not updated. */ static int memblock_reserve_overlap_top_check(void) { @@ -410,11 +424,20 @@ static int memblock_reserve_overlap_top_check(void) /* * A test that tries to mark two memory blocks as reserved, where the * second one overlaps with the end of the first entry (that is - * r2.base < r1.base + r1.size). - * 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 - * reserved memory. + * r2.base < r1.base + r1.size): + * + * | +--------------+--+--------------+ | + * | | r1 | | r2 | | + * +--+--------------+--+--------------+--+ + * ^ ^ + * | | + * | r2.base + * | + * r1.base + * + * Expect to merge two entries into one region that starts at r1.base and + * has size of two regions minus their intersection. The total size of the + * reserved memory is updated, and the region counter is not updated. */ static int memblock_reserve_overlap_bottom_check(void) { @@ -450,10 +473,19 @@ static int memblock_reserve_overlap_bottom_check(void) /* * A test that tries to mark two memory blocks as reserved, 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. + * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)): + * + * | +-----+--+---------------------------| + * | | |r2| r1 | + * +-+-----+--+---------------------------+ + * ^ ^ + * | | + * | r2.base + * | + * 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_reserve_within_check(void) { @@ -485,7 +517,7 @@ static int memblock_reserve_within_check(void) /* * A simple test that tries to reserve the same memory block twice. - * The region counter and total size of reserved memory are expected to not + * Expect the region counter and total size of reserved memory to not * be updated. */ static int memblock_reserve_twice_check(void) From patchwork Fri Apr 22 12:55:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12823395 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 7B88DC433FE for ; Fri, 22 Apr 2022 12:55:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC7666B0080; Fri, 22 Apr 2022 08:55:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E76886B0081; Fri, 22 Apr 2022 08:55:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CECDC6B0082; Fri, 22 Apr 2022 08:55:56 -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 BD0616B0080 for ; Fri, 22 Apr 2022 08:55:56 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 9524F8037D for ; Fri, 22 Apr 2022 12:55:56 +0000 (UTC) X-FDA: 79384512312.26.AACA541 Received: from mail-oa1-f65.google.com (mail-oa1-f65.google.com [209.85.160.65]) by imf09.hostedemail.com (Postfix) with ESMTP id 522C614000E for ; Fri, 22 Apr 2022 12:55:54 +0000 (UTC) Received: by mail-oa1-f65.google.com with SMTP id 586e51a60fabf-e604f712ecso8494186fac.9 for ; Fri, 22 Apr 2022 05:55:55 -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=vWWT9S1ut5UtdYn94rrDqYYPxhJGIa0Bw2tNIUfzycc=; b=UCaRhmUzpsSlR456w7eQ3PEwHtLCS2FCp2PPWQosnu/RVbQF4ATMHJR2zrEqzemnoy TTbPGGLkD0Pli4mKb83BJ7+pqNF020r5TQuX71sd43abDd8qQzg4q+bisVkuluxXDSM0 F9vNQzWYv8CN5559yNQOP2jvGRtEXcDqnaaAFxFvzopiNXLUP0NVL4iRmQSHMyZEwprr dyA8jLjaSIKWDKXE1EG6WaU4CTfr6rmFA1+wHIYDc7M9z4FKrIbdeUCdfyMSHPXQBS1Z GkG4pilfloCLFt3nAIo+Pt9XHB194SzNrxn9yn6+fM4tELWyuOLtmT8oK/OPcOQFDbfW fRsw== 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=vWWT9S1ut5UtdYn94rrDqYYPxhJGIa0Bw2tNIUfzycc=; b=ytbcuV5nQ0ByOwGZb6cwDtTp5kqMUBB7nrG+YLKSqxbZSehSFUfZdHlrUFQS04ABIx vbu7mmNzyxszoYxqEKAfTHGtXJGZhbOp+Rzg959ZUDm1LQiUT3cphH+2omK5UYz9hmOi ud0KN3DGxoRhq/66VxeJ121W8qrjhmsgeGM8yFit1gSiXAYKZ17KkuLTIwf61z8aBMLI JHeT0GjZLk6y/K8v8IrSz6bNo2X5YKPf1d67qnfQ2DJhueROOZFrDmDO27cXuuP0fAOJ kIWtuooS5o2r6mcMsXFFaeDEgr1i5clJUkvkkGNnPD8XZL28sHE9bVsbD+8H5XSnyVE+ NBpg== X-Gm-Message-State: AOAM532lwuagGqt4MhaoU8AgEswa6kVUKflOpMXrdraVu9gZbTvscC+z WXpJkRdpZNvYr2KyFpCyBOo= X-Google-Smtp-Source: ABdhPJwsjnPR0JnCBe7tNvuWVrHoysWmLCjrw1eXkP+lpnZ/gYO62bi5woJV/qy2lyUzpsa7hNeYvA== X-Received: by 2002:a05:6870:a1a0:b0:d9:b198:4cfa with SMTP id a32-20020a056870a1a000b000d9b1984cfamr1850895oaf.159.1650632155327; Fri, 22 Apr 2022 05:55:55 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id y6-20020a4a86c6000000b0033a64ed2074sm739421ooh.19.2022.04.22.05.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 05:55:55 -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 3/4] memblock tests: update style of comments for memblock_remove_*() functions Date: Fri, 22 Apr 2022 07:55:37 -0500 Message-Id: <3b83322c070bdd43a33c336d135f485244f107d3.1650631746.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 522C614000E X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UCaRhmUz; spf=pass (imf09.hostedemail.com: domain of remckee0@gmail.com designates 209.85.160.65 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: 4usbeya59nh7epk9rtdq8amejna6f4fj X-HE-Tag: 1650632154-169252 X-Bogosity: Ham, tests=bogofilter, spamicity=0.008984, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Update comments in memblock_remove_*() 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 | 101 +++++++++++++++++------ 1 file changed, 75 insertions(+), 26 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index 75cd7479ee54..08847dc5065e 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -550,14 +550,21 @@ static int memblock_reserve_checks(void) return 0; } - /* - * A simple test that tries to remove the first entry of the array of - * available memory regions. By "removing" a region we mean overwriting it - * with the next region in memblock.memory. To check this is the case, the - * test adds two memory blocks and verifies that the value of the latter - * was used to erase r1 region. It also checks if the region counter and - * total size were updated to expected values. - */ +/* + * A simple test that tries to remove the first entry of the array of + * with the next region in memblock.memory: + * + * | ...... +----------------+ | + * | : r1 : | r2 | | + * +--+----+----------+----------------+--+ + * ^ + * | + * rgn.base + * + * Expect to add two memory blocks r1 and r2 and then remove r1 region + * so that r2 is the first available region. The region counter and + * total size are updated. + */ static int memblock_remove_simple_check(void) { struct memblock_region *rgn; @@ -587,11 +594,22 @@ static int memblock_remove_simple_check(void) return 0; } - /* - * A test that tries to remove a region that was not registered as available - * memory (i.e. has no corresponding entry in memblock.memory). It verifies - * that array, regions counter and total size were not modified. - */ +/* + * A test that tries to remove a region that was not registered as available + * memory (i.e. has no corresponding entry in memblock.memory): + * + * +----------------+ + * | r2 | + * +----------------+ + * | +----+ | + * | | r1 | | + * +--+----+------------------------------+ + * ^ + * | + * rgn.base + * + * Expect the array, regions counter and total size to not be modified. + */ static int memblock_remove_absent_check(void) { struct memblock_region *rgn; @@ -622,10 +640,21 @@ static int memblock_remove_absent_check(void) /* * A test that tries to remove 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 removed from the available - * memory pool. 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 | | + * +-----------------+--------+--------+--+ + * ^ ^ + * | | + * | rgn.base + * r1.base + * + * Expect that only the intersection of both regions is removed from the + * available memory pool. The regions counter and total size are updated. */ static int memblock_remove_overlap_top_check(void) { @@ -662,10 +691,20 @@ static int memblock_remove_overlap_top_check(void) /* * A test that tries to remove 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 removed from the available memory pool. - * 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 | + * +--------------------------------+ + * | +---+..... | + * | |rgn| r1 : | + * +-+---+----+---------------------------+ + * ^ + * | + * r1.base + * + * Expect that only the intersection of both regions is removed from the + * available memory pool. The regions counter and total size are updated. */ static int memblock_remove_overlap_bottom_check(void) { @@ -700,11 +739,21 @@ static int memblock_remove_overlap_bottom_check(void) /* * A test that tries to remove 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. The test - * also checks if the region counter and total size were updated to - * expected values. + * (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 are updated. */ static int memblock_remove_within_check(void) { From patchwork Fri Apr 22 12:55:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12823396 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 2B4C1C433EF for ; Fri, 22 Apr 2022 12:56:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B68F36B0082; Fri, 22 Apr 2022 08:55:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B18616B0083; Fri, 22 Apr 2022 08:55:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B6EC6B0085; Fri, 22 Apr 2022 08:55:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 8C87D6B0082 for ; Fri, 22 Apr 2022 08:55:59 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 602F980380 for ; Fri, 22 Apr 2022 12:55:59 +0000 (UTC) X-FDA: 79384512438.13.F42425F Received: from mail-oi1-f194.google.com (mail-oi1-f194.google.com [209.85.167.194]) by imf21.hostedemail.com (Postfix) with ESMTP id 3DE861C002C for ; Fri, 22 Apr 2022 12:55:57 +0000 (UTC) Received: by mail-oi1-f194.google.com with SMTP id v65so4212256oig.10 for ; Fri, 22 Apr 2022 05:55:58 -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=ji65TxCA3tmlfdVknwpKYywGb2HaRNRxSvUyvFDLl9DdADHkKFKtq/axLT5OWcQLXR VBbUdCpfytKzdayozh+lb3fjIFUqs9q1pmdG6fgRgGyXB9haX4xZcM42qJmEIy3ZKCa5 pJQUR/2S8ratEbnuZSzo65Oc7Nu9AgV3JKJYRTigF/y98eSK03Z4VJuX/Z5OQjlONBtl FSp8g+0TY/bxP/AicBw7hgDrSSYCY/k4SBA9IKGPAaFX5METAsqmej7aLmAhkkQkTwQV Ng+GESGZ0bmX2vj3jiBKYh+ZsnkuivOFECYqCgXhnQN53JahE35kNOtRUSMSVLoOyhdj HnEA== 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=DYTPG+B3fynlDRsxkGmGB5a9iAPOgLsAPrUOL1vlPad7ybQoLoQJfntxLfNjlzaxwi 8BLKKtXeCAHZ3w72fQOtrKBIS4x15LbOJsf+eeUOFnNzaFMV70b56Xe+4vz1kkxuSSfI zG8ceD4QIdJrEluMqIABoaWYCCEiFL5BfvMz+UMf0Cjjebb4rQmNF5C0Gyu0G4wQ9UYu Cfmbuw943TduIRvhNKjAkodlBz1TtYXiEzE+JMXhcz7m3ImRRJwylXeIngc+5iuOV4R6 7Xn37bRDMyHa9oguTuywB5tg9vOyhINTkEYU8CQkXJTynOV4UAh5muXKhDUqleJt0bS8 XhKQ== X-Gm-Message-State: AOAM530e+SpeeYbJx5Q+sBZb2zj7Z6PWcpM7SZ9mwhA2383Wp933jCU2 DceJ2dnyterAEQn+9Dx9MYk= X-Google-Smtp-Source: ABdhPJyJrr0CiATpo13Emrrr6nQwwKUUt71Wrui52IDGpgAulqrm9p4NhEldrtfJveTtJYcerJqKGQ== X-Received: by 2002:aca:a907:0:b0:322:6cd9:2533 with SMTP id s7-20020acaa907000000b003226cd92533mr6447627oie.74.1650632158209; Fri, 22 Apr 2022 05:55:58 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id e47-20020a9d01b2000000b006058d31851esm339289ote.77.2022.04.22.05.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 05:55:57 -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 4/4] memblock tests: update style of comments for memblock_free_*() functions Date: Fri, 22 Apr 2022 07:55:38 -0500 Message-Id: <4952e3dce1147685a7ad0ae41287348e9e3f7f68.1650631746.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ji65TxCA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of remckee0@gmail.com designates 209.85.167.194 as permitted sender) smtp.mailfrom=remckee0@gmail.com X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3DE861C002C X-Stat-Signature: tmcs89ie9uumtu5dgnhg71mkrxtp7bgq X-HE-Tag: 1650632157-136380 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 | 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) {