From nobody Sun May 10 15:44:05 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 AD398C433F5 for ; Sat, 30 Apr 2022 22:49:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236085AbiD3WxU (ORCPT ); Sat, 30 Apr 2022 18:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiD3WxR (ORCPT ); Sat, 30 Apr 2022 18:53:17 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E350D69486 for ; Sat, 30 Apr 2022 15:49:53 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id v65so12055903oig.10 for ; Sat, 30 Apr 2022 15:49:53 -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=R1m2/yma9+xrc4M9pvudxqT56p82zVBLGfgv/vF3VXE=; b=d7lqz/KT4zcyWw8uAp7ZSQyPV+F0vWQN4RK4FYzHN2KxY2mUMl3XsehUSGZu7fxJpL vBpNGIuSA9np4U4usS1oWlm5MYeebPhUIwbyNGvYb7wyJ2wskIhvT/np3z5tGVXqTLyc gAkwQNpR5CK+x0wUWPKJ1O991qo3QLlpqerXuZuEebeje7jYg8eYQs+WwjakMlggHjE/ 8NvUhAjBg7DDfj65tsElAJtVc3uPhby1eR5CWgl7I4YPL2MBJGR1lWF49FkKkEP1+rkc PnUroInfdqyJEiAXcmBPqOrrodBPw/Qi7OYo4XQ4kCm2z6NLOMnpvkHJMyJSubQiydF5 KOtA== 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=R1m2/yma9+xrc4M9pvudxqT56p82zVBLGfgv/vF3VXE=; b=r2bcN4nIqhAkIm9xZ87Ec9sdgstRkCMXgfk+xOy22B4W2hcypJaC7FA5G33Kcs1i/x lbH8eQiMxuzaAdYObrMZG7NKQZKVt6OLjciTr8vrXdmGj2WOHrNkBwEEAHn6L/kgj4Ss ALeG9l/Vds7Rb4lMBTaSUAghA4FC4tZ+EXBj4I4MzB20qvKtZsC6DZ2k27ShUU+pBcXd eRxYa2E8VPeIFJStxOxPRgUR0r4jA5+buokprXXu4V7ORc/lu/x01Wg0qQ57hf+v3+95 5N5Zz37l1KubaEtJuim5Rc+ONks144k1HFrTeazJSAsRa6KEZTMWXyNj7ZgH7C5JXVpC mTzg== X-Gm-Message-State: AOAM530MXXTZmvCeHjlo3lYbeoZe+/NUO5hJie4+xHs8QdvH9bETt59y chMG/btGBqZC5T3NO60MBeU= X-Google-Smtp-Source: ABdhPJz1IWYUVrgrrsrI8utFOAKEd0OVSn97ROtLuIa3Tx464K8UnqdVsJ5G3qTrKTknRycvRB1RRA== X-Received: by 2002:a05:6808:30a9:b0:325:e5a7:1c49 with SMTP id bl41-20020a05680830a900b00325e5a71c49mr967205oib.153.1651358993118; Sat, 30 Apr 2022 15:49:53 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id h22-20020a056808015600b00325cda1ff95sm1026360oie.20.2022.04.30.15.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 15:49: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 v4 1/5] memblock tests: update style of comments for memblock_add_*() functions Date: Sat, 30 Apr 2022 17:49:36 -0500 Message-Id: <3d735aef1d50e215d738519cd285a5b593710e13.1651357434.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. Reviewed-by: David Hildenbrand Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/basic_api.c | 85 ++++++++++++++++-------- 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/membl= ock/tests/basic_api.c index fbc1ce160303..ab8d71b1e24b 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) { @@ -124,11 +130,21 @@ 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. + * A test that tries to add two memory blocks r1 and r2, where r2 overlaps + * with the beginning of r1 (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) { @@ -162,12 +178,21 @@ 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. + * A test that tries to add two memory blocks r1 and r2, where r2 overlaps + * with the end of r1 (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) { @@ -201,11 +226,19 @@ static int memblock_add_overlap_bottom_check(void) } =20 /* - * 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. + * A test that tries to add two memory blocks r1 and r2, where r2 is + * within the range of r1 (that is r1.base < r2.base && + * 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 Sun May 10 15:44:05 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 79C22C433EF for ; Sat, 30 Apr 2022 22:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245705AbiD3Wx0 (ORCPT ); Sat, 30 Apr 2022 18:53:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235875AbiD3WxT (ORCPT ); Sat, 30 Apr 2022 18:53:19 -0400 Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F94E69486 for ; Sat, 30 Apr 2022 15:49:56 -0700 (PDT) Received: by mail-ot1-x342.google.com with SMTP id y14-20020a9d460e000000b00605ee347da1so4975616ote.8 for ; Sat, 30 Apr 2022 15:49:56 -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=bG37rvcep9NRYqYV++Ee/JVfkX0YlgX6zU5PsGTmvc8=; b=ME9eSKKJT4KOyft/ekv2IQm9FhMq0P5+6hW4Iiq5+V3dpm5nQRjUpk1v2xNulr78Gk ygckxMsgCyRrO1RplfI69ubjhYPSA4fY5SLfmHd+A2kIDpq3ksoFTkccWldjpnyrTQon bLTr6Ah3sMN81SVd1GLAH4RSZt3GdoBsWibhQDWr44Vw6nFLXiiJB0j/gYoDder5vEWQ i7wl7AH3I95BQvP0n1fgusm0XAUgjAnRt331mvvSh2r3DAkXBnlIiMOps3MhHskWlk3H BW5o7FQxkAOzGlQrHWry+6lFNwivrOzjlKozQcmL0HLJhEsDjh4HL1UdFfNbwvDNWQAW NKkg== 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=bG37rvcep9NRYqYV++Ee/JVfkX0YlgX6zU5PsGTmvc8=; b=Rr4LyO1QPY11Z2yjS2UHYdfT1tPN/5Ryz9K5Q+bWDG0Rv8S3984lgAO8n0gy/lg0jZ TC6hGlxB7NRTfx1qBoow5vkMXaPmqgsSaezQ64bTI9seuJD2A105qXNnKStDZE7dvtZX N1FC8kBVUMBEqMFbTL5LVG8KPGrMMPpBuS3nvdetAu+KMHlalpeNIHt8/Legyze+Nddv Ka60FwUl8c/mV/MBQSvBPU9ViG0+rGFpri369czJMzbISwIayK767T7YLK5iin3olsgB iMofGBjYxRZ8UlItGLVb1e+8S0X8CAVRoBSmqZH1TmO4fVDetRs5u8UilXPRBuFdyJGP Vh4w== X-Gm-Message-State: AOAM532NUVk/dQDdy/pbTGY42AsRV2cWgtSmQMHx2Hsu3eCYBo7xev0t g25Rs7RKr1LnvYOa5JmH+NXH0khXTG8= X-Google-Smtp-Source: ABdhPJznJm1itKSDf/m3vlvnbHvAEbJUxILanJO1EwBl14QPFWK3jBHS5Zl3rl/4097Q+dlYgTWQ3w== X-Received: by 2002:a9d:6a4d:0:b0:605:df01:9858 with SMTP id h13-20020a9d6a4d000000b00605df019858mr1980565otn.87.1651358995614; Sat, 30 Apr 2022 15:49:55 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id bf22-20020a056808191600b00325cda1ff92sm1035946oib.17.2022.04.30.15.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 15:49: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 v4 2/5] memblock tests: update style of comments for memblock_reserve_*() functions Date: Sat, 30 Apr 2022 17:49:37 -0500 Message-Id: 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. Reviewed-by: David Hildenbrand Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/basic_api.c | 94 ++++++++++++++++-------- 1 file changed, 63 insertions(+), 31 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/membl= ock/tests/basic_api.c index ab8d71b1e24b..6054b83962ca 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) { @@ -368,13 +373,22 @@ static int memblock_reserve_disjoint_check(void) } =20 /* - * 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. + * A test that tries to mark two memory blocks r1 and r2 as reserved, + * where r2 overlaps with the beginning of r1 (that is + * 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) { @@ -408,13 +422,22 @@ static int memblock_reserve_overlap_top_check(void) } =20 /* - * 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. + * A test that tries to mark two memory blocks r1 and r2 as reserved, + * where r2 overlaps with the end of r1 (that is + * 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) { @@ -448,12 +471,21 @@ static int memblock_reserve_overlap_bottom_check(void) } =20 /* - * 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. + * A test that tries to mark two memory blocks r1 and r2 as reserved, + * where r2 is within the range of r1 (that is + * (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 Sun May 10 15:44:05 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 87E75C433EF for ; Sat, 30 Apr 2022 22:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245454AbiD3Wxa (ORCPT ); Sat, 30 Apr 2022 18:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiD3WxW (ORCPT ); Sat, 30 Apr 2022 18:53:22 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E7147053 for ; Sat, 30 Apr 2022 15:49:58 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id e189so12060625oia.8 for ; Sat, 30 Apr 2022 15:49: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=qLuBgx3aGNrQr1Hd6LLIUfj9oL8+d6PIj9EzKX9KAkA=; b=fToJ7y+Ajk+cmYzGp7cGLtL/BpQuBP1P1jlQ3oncc7zoizJVxenp+9PX01mlJ8Ig6+ nbU5/9rqLBkEivdoHfOToJ5caRTeL0GeuKpnDUuGdS1nLvRuKhHh9xDmDp8giyj70rMO /aRx5PG28R6D4YMrcpOo8UDrsp0yLGbgpaQBVuZrCQKbjNprtF1jp1e4QD8Ih0E8y5BI XzW/5QYXjqApyPnrcbqITIal/AP6XM490MNfNaZ21o8HE9T9ZIOubrBSAVXnKpF9vz+s +/TPN3xuK1l8SCOYGGDjpfxUi5BQIupERKU8xDOdJ1Or4Tce0Tw9LDtJPpc5ChkalPx4 GDqg== 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=qLuBgx3aGNrQr1Hd6LLIUfj9oL8+d6PIj9EzKX9KAkA=; b=r5PPT7hLTg4kOCjIM9Mv+/lCeIBmqOJ35qj4ck01QbamzM8ScN+qSz9Ui9Nwag92tt Mp6MR0T1ydVX4VR0F5IpJM/myP4EO7HWQAGHvnXsln1I177A832G1YWXReDhAgnAgKu9 kyDROy71JOhZqYzIwpmO561RiPKsKD7GEvnrebOP3jPmPUxbGac800NFnS07ihJvt19X 8IMxBabyRx4ep+LMTRYO3eVYFVoim61KVoInPNO9vhIXnr6/OGL0rPCG9f3Mo+lQPHCr xXNAd6rMgityk5hCtyqWbW6lRNOUprTm0LNkiFA6jlUp/dkshZT5c9ucab78cfkcDCnH qxlw== X-Gm-Message-State: AOAM53197ZWyjAV1diZnKbALU+a2uUh8+6NqUWu7UzUGl0RMsRzbU0ba 5Y5SoNqKP/Hn2mgyLhKgAUw= X-Google-Smtp-Source: ABdhPJzVlTi0naNqLnoQa74Ympt3loKHlOay3fdVfQHoIbfLvMbm7mPEM2yirkXCvQIKNY4QUSj38Q== X-Received: by 2002:a05:6808:21a3:b0:325:7d2f:87b2 with SMTP id be35-20020a05680821a300b003257d2f87b2mr2677565oib.102.1651358998281; Sat, 30 Apr 2022 15:49:58 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id y203-20020aca4bd4000000b00325cda1ffadsm1027636oia.44.2022.04.30.15.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 15:49: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 v4 3/5] memblock tests: update style of comments for memblock_remove_*() functions Date: Sat, 30 Apr 2022 17:49:38 -0500 Message-Id: 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 Reviewed-by: David Hildenbrand --- tools/testing/memblock/tests/basic_api.c | 111 +++++++++++++++++------ 1 file changed, 81 insertions(+), 30 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/membl= ock/tests/basic_api.c index 6054b83962ca..37b7cc075b0f 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -550,14 +550,22 @@ 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 a region r1 from the array of + * available memory regions. By "removing" a region we mean overwriting it + * with the next region r2 in memblock.memory: + * + * | ...... +----------------+ | + * | : r1 : | r2 | | + * +--+----+----------+----------------+--+ + * ^ + * | + * rgn.base + * + * Expect to add two memory blocks r1 and r2 and then remove r1 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 +595,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 r2 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; @@ -621,11 +640,23 @@ 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. + * A test that tries to remove 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 | | + * +-----------------+--------+--------+--+ + * ^ ^ + * | | + * | 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) { @@ -661,11 +692,21 @@ 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. + * A test that tries to remove a region r2 that overlaps with the end of + * the already existing region r1 (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) { @@ -698,13 +739,23 @@ static int memblock_remove_overlap_bottom_check(void) } =20 /* - * 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. + * A test that tries to remove 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 are updated. */ static int memblock_remove_within_check(void) { --=20 2.32.0 From nobody Sun May 10 15:44:05 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 D221FC433EF for ; Sat, 30 Apr 2022 22:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353952AbiD3Wxh (ORCPT ); Sat, 30 Apr 2022 18:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237523AbiD3WxZ (ORCPT ); Sat, 30 Apr 2022 18:53:25 -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 471777C17A for ; Sat, 30 Apr 2022 15:50:01 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id 88-20020a9d0ee1000000b005d0ae4e126fso7523835otj.5 for ; Sat, 30 Apr 2022 15:50:01 -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=g5ZKEjvUZZhyN/k9cXP2KVhc3ccJ7QzsFFOrc94at31E9cGGb4ZDuuRG5CXt7tMKeQ PmMFEyG85UdlKqhiJo/QXsTaMVx5cJAGvOoGDnKy3jYbElzslKNmz9DQMmoFg/MzM459 /GQbn0DUpdwYZSgsM4lCc8GlMV0WMXTKEpLRi69X4SH1aQP+u4wcJgniHETMNj2i30l2 d/icDjb/wLAV1z5kFHYDAy8DjVWtayXquGGE+fRTH4LLx9bLtcolRKGd5pnp++uX+vbd tHVeEah/hHtGOaF6j2gBcttPXyy+AVsE5/jBovZIk6Mkk3n6S4Bpn6ctYZ1ZNmYCFG9V ibBw== X-Gm-Message-State: AOAM532OW9+Ir4s8CUw9jaaS6cpaZ4wHFRLVp73/Dm4BnNqhJlSAtRT/ kvS9UoDa8vdTuMNm9jr17HIQxmxS8YY= 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 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 Reviewed-by: David Hildenbrand --- 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/membl= ock/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) } =20 /* - * 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; } =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 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) } =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. + * 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) } =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. + * 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) } =20 /* - * 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) { --=20 2.32.0 From nobody Sun May 10 15:44:05 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 BC645C433F5 for ; Sat, 30 Apr 2022 22:50:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358131AbiD3Wxn (ORCPT ); Sat, 30 Apr 2022 18:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237110AbiD3Wx2 (ORCPT ); Sat, 30 Apr 2022 18:53:28 -0400 Received: from mail-oa1-x42.google.com (mail-oa1-x42.google.com [IPv6:2001:4860:4864:20::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327EEB16 for ; Sat, 30 Apr 2022 15:50:04 -0700 (PDT) Received: by mail-oa1-x42.google.com with SMTP id 586e51a60fabf-e93bbb54f9so11358815fac.12 for ; Sat, 30 Apr 2022 15:50:04 -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=SlZXS31/hv1yey3GZfbcR/cwUXkVaB/SG7lf/EOgofrXGn3aOXrj4eosMWiBiwwCUY mznrGQh0r5NPWXckqu7j7ukJaE5unMRyKuU8rXDZgqsrMP40qLL9LtniPNnb9on35Bw0 6iJtkpvDJjmEsv5Wz6la6lTKm09UI9mHSKawMuh2zxdw5Z5jM0l7JGcPv8LhfR53/lT8 0rzh4+1kCWGGQbwNGSRuRTRTaEI4tdjCVPiuLpuOM5/YD1Hx6TiJsI72cltrqZgX2H2P 5+gInEQ0oCdAsPlq76ChSeBKjvOdZOyMn+lpb9bNWG/sXpyieutTOIIS5TdnvO/MXGAm yeMA== 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=5urRhjZjSByzQi1duBOmr38t+yhwfB83cZyNxNODTVYmXpHcmaxVPCuVpMDEbfSu+7 nJ2MWdp3oL2EHqdQuLqmepaPOMKaXqRBU3djMZgCAbZvlUf5q8dLC4+NCA86hR7h5D9E BU6wTM/T5tqaXmuo9FXf8UqWZitKZyE+993NVOlIEiu63AmJOcEaWuh9GvmFA2m34g06 jnFZ9ukVscszl5+HgbjIRoJ8ZmOAFq4KlKmcw7TiD//RXpiN7lqbdt+nn0FMSW5jLRGc 8x20c1KBaDTDQyP0O9LornuZKVENVnTsiFcyikqXzzVpWg4FLy4ZIbocGW+sYxj20HwR vUJw== X-Gm-Message-State: AOAM530jehyS01217uFP2Efv/4j0bkjA3NshGKBNLKyhv8h2GoCbrvdV WVJYY5uKlT2T/no9CYVrO/c= X-Google-Smtp-Source: ABdhPJzVHCIx4JQceoZTOZI8SmdwY54K7u6kmktJ1v22KmjV+AYTOclHcyF8HKkTDM3w4T8yGVgwfA== X-Received: by 2002:a05:6870:2186:b0:ed:97c0:e334 with SMTP id l6-20020a056870218600b000ed97c0e334mr940677oae.205.1651359003607; Sat, 30 Apr 2022 15:50:03 -0700 (PDT) Received: from bertie (072-190-140-117.res.spectrum.com. [72.190.140.117]) by smtp.gmail.com with ESMTPSA id i1-20020a056870a68100b000e686d138a0sm4430318oam.58.2022.04.30.15.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Apr 2022 15:50:03 -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 5/5] memblock tests: remove completed TODO item Date: Sat, 30 Apr 2022 17:49:40 -0500 Message-Id: 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 Reviewed-by: David Hildenbrand --- 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