From nobody Wed May 13 19:27:57 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 557CBC433EF for ; Fri, 22 Apr 2022 13:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447939AbiDVNgN (ORCPT ); Fri, 22 Apr 2022 09:36:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447993AbiDVNgL (ORCPT ); Fri, 22 Apr 2022 09:36:11 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9FCB58E40 for ; Fri, 22 Apr 2022 06:33:17 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id s21-20020a0568301e1500b006054da8e72dso5491168otr.1 for ; Fri, 22 Apr 2022 06:33:17 -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=pdXwU9el90n1POz4nfj8QsiTcX9DfG9tM4whbkiza4N2KIeXrBHlZxGZ9reLzlm+s0 1G1ptjkAGTBlPN+eiLUGBwXXG8VgifGHGYD2a/DrG14OeGf73pWa1WfcfEZK7FmLUphE FHDAlFHFImfO5YOYghNBJ0n7wvm9OoBL9WwHezpJpfAAziK6n1AmJES8ygXYzNLTJjfT NB1CwTWxjhI/+JjvbuxgprD6y3InrJLD9izkkLLXh2GNor1g3pi1/0faYg7uwb+zg7Gj GFNpG4aWRph7E1T+mXGEYI/6rUocYpTagm81+ww9c/iAiZa7UA7lL5+yUZBTCPz6DDgB NzOg== 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=oEe1sZJqMAc/Zv95NbMXhEXIB9YFGPWRzrrpcN6xP4ddNrV9IPVZ7dG/5tak8Cl/PF TNNtCjC/wq7I5pfL1njPI2P/mbyv7z52sfcgJdyWMJ3CQHYfWOJAI/Cxe+hjDzN+V+Ra oktMdcPUNofLtudr7RtRwu+RNJWNJbBrJ14+YmiCHrz6nM6dxfcc+ta1JVHtT2mXzz/s /JAKv2JGb/PBOt1zEM1XS/uWXglmz0QGbJl+1Af293l19NkH9eQR9SPoEu3MNcn3W/0H WwjfmDrNeWMXaNfheaj6PSt43TIiOl5RvglK1RMm4I4msq0v+Bq67wJRHtWhQnwNcgKN aMEg== X-Gm-Message-State: AOAM530vawIEQi5RmCjd8Scm0ynXWRMOmTyuCHlFauALzBkl+jrjTKHa yHPtBActsx7QWN/ReTQEqbk= X-Google-Smtp-Source: ABdhPJxgToPmJWgewVsHFQryinVlA4PpvFcNIna3LchciFNaCobmyWc5DI9azV1+2JjWCghKRCWIxw== X-Received: by 2002:a05:6830:3153:b0:605:84df:bb59 with SMTP id c19-20020a056830315300b0060584dfbb59mr1258471ots.223.1650634397125; Fri, 22 Apr 2022 06:33:17 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id n35-20020a05687055a300b000e1e2ab91e4sm622744oao.39.2022.04.22.06.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:33:16 -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 1/5] memblock tests: update style of comments for memblock_add_*() functions Date: Fri, 22 Apr 2022 08:32:58 -0500 Message-Id: <2ea997e7b5c4737d674a2e5d9288938d557cb0c3.1650633253.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: David Hildenbrand --- 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/membl= ock/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 me= mory - * 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) } =20 /* - * 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, siz= e, * NUMA node and memory flags to the collection of available memory region= s. - * 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) =20 /* * 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 t= he - * 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) =20 /* * A test that tries to add two memory blocks, where the second one overla= ps - * with the beginning of the first entry (that is r1.base < r2.base + r2.s= ize). - * After this, it checks if two entries are merged into one region that st= arts - * 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 cou= nter. + * with the beginning of the first entry (that is r1.base < r2.base + r2.s= ize): + * + * | +----+----+------------+ | + * | | |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) =20 /* * A test that tries to add two memory blocks, where the second one overla= ps - * 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 st= arts - * at r1.base and has size of two regions minus their intersection. It ver= ifies - * 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 me= rged - * into one region that stays the same. The counter and total size of avai= lable - * 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) } =20 /* - * 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) { --=20 2.32.0 From nobody Wed May 13 19:27:57 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D06C433FE for ; Fri, 22 Apr 2022 13:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448027AbiDVNgS (ORCPT ); Fri, 22 Apr 2022 09:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448024AbiDVNgN (ORCPT ); Fri, 22 Apr 2022 09:36:13 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5233C5675A for ; Fri, 22 Apr 2022 06:33:20 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id c11-20020a9d684b000000b00603307cef05so5489566oto.3 for ; Fri, 22 Apr 2022 06:33:20 -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=iaxa/qlkHIPUaRAIv7RENsm5uqvFD5F+AGD11htqjVrxDJvvnB6oIgtTQBL+ZnA9YK iN0zUp7SMP9/UGwNyTVXCIR2UwIJ18j+457n6lrMlE/yZe3Nr2EXmePrh+qcq7rQoodV RKI6X9CBoVNmWhCXivgsrzJN8eMI+Vlv6RPsvG0vwHiJKtk9qvODKOWZi2WrwGZa5/TI T4OBybc0MC91K3CowfTdruAkQ7/IrMTmLilzuM3aZqxL6xLvZH5D8D/s/jN6M3NvVMmY hNBZ0NP+lKCejF4WYiMvdLlz3Yru9JlIV7VymBAW9WUUVB1Y7oJmdQwBcD0BaOpg7hnk O+yw== 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=I/XbmRwjtlUwn8lL7Fnqnp+KCVL+OmKxsOrPX7A//xcddCHcl81wuKnLSFMj5ckZ6/ hBKegF2C/PKOqemuIfUgWOcXR7T59HdvU/8ejbZyCWFyiPPUmUv3xYmXxkSSlNdS5Oti eJGpmLAWWYSSgUk7goKmEojpHsOrA7tAuLmBoCvUGlOdeizpw8EvFRNNGPXCsU38ehHe eKc/JE5Yo1KUUeRIVMeVY4XxqgAfNLfYApQUBnkMD71C9UfahqlZp0XGDIFFZkJ0EK+V aOEXe5NgCrUKHdt3XqBkGef19FjHbDql2YG4ycewzbR+sFKsWken/+C+vTL5Mc3ErSyq VmLA== X-Gm-Message-State: AOAM533Z9lUGhF0NPgGoMWs3xvgqUhCdB3LXTfAKJWjpc5bms9ZafeZa zNndSNWeIcCSOEvEeZrS04w= X-Google-Smtp-Source: ABdhPJzbXMkh8RjqP6Pa+d7iGuUJTgcOFvN07w1TH7hp9iR6U6Bwz2ZaNrs8joSVIhNvkQhAtRcH6Q== X-Received: by 2002:a9d:4d98:0:b0:605:4cbe:1a3b with SMTP id u24-20020a9d4d98000000b006054cbe1a3bmr1676131otk.292.1650634399534; Fri, 22 Apr 2022 06:33:19 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id bq4-20020a05680823c400b0032304581da9sm766688oib.13.2022.04.22.06.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:33:19 -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 2/5] memblock tests: update style of comments for memblock_reserve_*() functions Date: Fri, 22 Apr 2022 08:32:59 -0500 Message-Id: <7e21d96491ed573f1f7823cfe56c4d8ced4f78fe.1650633253.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: David Hildenbrand --- 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/membl= ock/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; } =20 - /* - * 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) } =20 /* - * A test that tries to mark two memory blocks that don't overlap as reser= ved - * and checks if two entries were correctly added to the collection of res= erved - * 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 reser= ved: + * + * | +--+ +----------------+ | + * | |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.b= ase - * and has size of two regions minus their intersection. The test also ver= ifies - * 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.b= ase - * 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 t= he - * 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 seco= nd * 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 no= t 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) =20 /* * 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) --=20 2.32.0 From nobody Wed May 13 19:27:57 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83C53C433EF for ; Fri, 22 Apr 2022 13:33:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448036AbiDVNgY (ORCPT ); Fri, 22 Apr 2022 09:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448025AbiDVNgQ (ORCPT ); Fri, 22 Apr 2022 09:36:16 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0E4583BA for ; Fri, 22 Apr 2022 06:33:22 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id w194so9012557oiw.11 for ; Fri, 22 Apr 2022 06:33:22 -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=iSjgOmJph0wI9W9moIoXgUb4CbS77tWvK87utauHR+6Ec3lu9iCOjOKrPey6QWPLPS 6v4qa3wD3p7p2nja/OQAv5gz3LLVHJkfiP0D8EaZM0CXGfEljtRDWp2lQunorYflBFXI YVL5+4kIGFtcHehI1OhtkZIx2JL9SKgyAlvdei/ZVfws25BxhpIJdLIA4iSNOjLtoCCG Ltqy95QdlkdZ8M+hvBX4kYXIN9/ij1Q7nAJtoLaUMrhY2Tm+nhvinFwjFm1oumz/WxeZ v3nVvZMdq6f3z5V14CVLHOylKKafekCo689D1U5wxl0ac6pFVhM6OkTuwq7ZMQHGCV96 DFjQ== 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=saAtYb7HXuKrGVBQmyw9qqtnMlg0j5CWYY5vBRTptxwG/bsJ6ncV+r26dnZcx97P+H a5HGBk80yZUg5TDXZ9AZAFY5f3CLmnKijnc2+JaefSQWuG/OAAozoLwxTBd/1IZoh2Me uNHcdbupWyqNFi3/NPIMUzzs1cY+wxF1P3kbtz4kY59H1IauFtV0Bis7AcjimFHr3+5X 8g+EPg0EJsTSP1UpdU1IjoSokbf4QLLWtffl0Ynu8VknXwv6yUsfwYK4e3DoXM3IKasR mIaBKNMOovX6Vz4x9TGD2vyjCR6P9IL5OhjX5/UcY8AzhyMK5k3tWGyFc58E1O3eNhgW yqJA== X-Gm-Message-State: AOAM530AsuikDQ0ikuCsrnNx1UNju1guLU2jfgdSmdwCQfxkUnhsyMCe j/X8TcF8m13zx6L7uc7PMNE= X-Google-Smtp-Source: ABdhPJw2WQ/OVm35pqkbglbSshfHt4oKxslDglb4Myr1bVgiekofd0Lj4FByZNNqa1B+FNWl24Fitw== X-Received: by 2002:a54:4719:0:b0:322:6ce1:6fa7 with SMTP id k25-20020a544719000000b003226ce16fa7mr2092564oik.105.1650634401866; Fri, 22 Apr 2022 06:33:21 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id u3-20020a4a9703000000b0033336ab4909sm788777ooi.7.2022.04.22.06.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:33:21 -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 3/5] memblock tests: update style of comments for memblock_remove_*() functions Date: Fri, 22 Apr 2022 08:33:00 -0500 Message-Id: <3b83322c070bdd43a33c336d135f485244f107d3.1650633253.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/membl= ock/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; } =20 - /* - * 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; } =20 - /* - * A test that tries to remove a region that was not registered as availa= ble - * memory (i.e. has no corresponding entry in memblock.memory). It verifi= es - * that array, regions counter and total size were not modified. - */ +/* + * A test that tries to remove a region that was not registered as availab= le + * 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) =20 /* * 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 ava= ilable - * 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) =20 /* * 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) { --=20 2.32.0 From nobody Wed May 13 19:27:57 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A266C433F5 for ; Fri, 22 Apr 2022 13:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448060AbiDVNge (ORCPT ); Fri, 22 Apr 2022 09:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448031AbiDVNgV (ORCPT ); Fri, 22 Apr 2022 09:36:21 -0400 Received: from mail-oo1-xc43.google.com (mail-oo1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9E5558E43 for ; Fri, 22 Apr 2022 06:33:24 -0700 (PDT) Received: by mail-oo1-xc43.google.com with SMTP id 1-20020a4a0901000000b003296ea2104eso1401174ooa.13 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=7cAqYMkdLI552UiOU3PIA34zdXNUCtv5l1ICzSdlL+P0TYrgyIGWVPDAna9ZhNXV6a O0vF0pR7v/RF4wybcnAkePZE+HyRi+AESzPxaOlD6euDgyyoUhpReFouqhbFwPdgD/mR ywDzynG9Jqkv8nSwSmnsaFLLo6O+jGDTiDuMSY6OotdP4DKj8lXBCoGGNDA+gIcToiqS ZcWrSykDC42EhaDsPDEN8sBGu+ZOgW8qchaeOgK3aimAW5j7WNedNd8n3wIcTZApGXt1 ZM05aaKtm8qzs2ClrVqgH2UFVeUsdst+NI0IkNrcEkWb9HFE8VIHxlFnjhyK4jSLukae XKRA== X-Gm-Message-State: AOAM530P/v69GcH4+Va2Tw4gg5pZMqlkC8lo4M/u9MaHnW/WMYezb7c1 q1zYj7yP0zpt3Ofb85fp4Wc= 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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/membl= ock/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; } =20 - /* - * 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) =20 /* * 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) =20 /* * 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) { --=20 2.32.0 From nobody Wed May 13 19:27:57 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE79DC433F5 for ; Fri, 22 Apr 2022 13:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448038AbiDVNga (ORCPT ); Fri, 22 Apr 2022 09:36:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448034AbiDVNgV (ORCPT ); Fri, 22 Apr 2022 09:36:21 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D528258E4C for ; Fri, 22 Apr 2022 06:33:26 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id t15so9062885oie.1 for ; Fri, 22 Apr 2022 06:33:26 -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=de5cYv9udGhvYDO7mNwHuK98M+en+qgo8AFwYs9167Y=; b=RcwvHmsLpebm7Ci3Xt0BAlj7oa76AW3bGWew8HCMNJxyK1SuDq2YGUAvG97nOq3Eo3 KsAn8/JRYLPyhgAEfU98ydLP9sr7+kVoFWqn567X8F77dqtAG7xTwe0fG43/CgCcvSuP ehqXus3Ts+GejURjxBs5Rm6L9OZ9bIHh/rBLTGuif4ruJVxASyoKso1y87nxpfZkpIn2 LAZSVjygJ88KEQjUXkUJvF87yuqNLlVvmUojOVtqkzG4IC/X4ag3AvJLwn3n0CgzHZCR qOT5f80Qii8tstUWxSnbyfRZFRdndFKnPHKpdJwn67x49JXv+qhogJjE1UhtR5aEXTSr NyZw== 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=de5cYv9udGhvYDO7mNwHuK98M+en+qgo8AFwYs9167Y=; b=FF2FUCPKIuZ2+8nSn5QYYoEg8SMfP3vwYPo8UKie6F4AWPYIwlb9M/5Rj7vxe1ZJEJ F22nrHjD+J852Jj07yaQm57OBPsoV3Hp7zQGN7HZws0mBPsC4NDGnu78QIOtrgRHd/5h 1Z0EAjXZB2sO98kmA2kK0//v9pqlQrY05Ke2CKlvypFGfEgaFrTtzpgcqQ047wmlxiSt +oCivX4Vy97mvEVKFulBevW0I8nWiCwC9fSJ18n9qk3p8n+ums/5s9qazioiyLgLGq65 YnUdpYyzp0NfGjPiu//j4fD2NWGKpg+ZWyzUWaGSdTOgd5G/9/oyAkhWK7vlg+qrQn+8 RvDw== X-Gm-Message-State: AOAM532SuGD10jG6pv/a0NZGJu1el6g+OcU6bQK297uKxgnOFou1PWap yX0iBZEukU83EYBPCtFj7d4= X-Google-Smtp-Source: ABdhPJzfVz3jSr2UPzaynpM2Jy1ECjorM1FHE4t1xa2lixCvgu3KZmnZ3G6+f6bpdTXu7Kccq4ASEw== X-Received: by 2002:a05:6808:e8d:b0:322:bac0:2943 with SMTP id k13-20020a0568080e8d00b00322bac02943mr2234162oil.126.1650634406199; Fri, 22 Apr 2022 06:33:26 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id o2-20020a05687072c200b000d9ae3e1fabsm641007oak.12.2022.04.22.06.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:33:25 -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 5/5] memblock tests: remove completed TODO item Date: Fri, 22 Apr 2022 08:33:02 -0500 Message-Id: <201729cfd08cfe5a8681f815b4a423455263d03d.1650633253.git.remckee0@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Remove completed item from TODO list. Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/TODO | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/testing/memblock/TODO b/tools/testing/memblock/TODO index c25b2fdec45e..cd1a30d5acc9 100644 --- a/tools/testing/memblock/TODO +++ b/tools/testing/memblock/TODO @@ -23,6 +23,3 @@ TODO =20 5. Add tests for memblock_alloc_node() to check if the correct NUMA node i= s set for the new region - -6. Update comments in tests/basic_api.c to match the style used in - tests/alloc_*.c --=20 2.32.0