From patchwork Sat Apr 30 22:49: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: 12833448 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 3C30DC433FE for ; Sat, 30 Apr 2022 22:49:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA4D26B0073; Sat, 30 Apr 2022 18:49:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C53F56B0074; Sat, 30 Apr 2022 18:49:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACE376B0075; Sat, 30 Apr 2022 18:49:54 -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 9EC746B0073 for ; Sat, 30 Apr 2022 18:49:54 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 4B23780BDB for ; Sat, 30 Apr 2022 22:49:54 +0000 (UTC) X-FDA: 79415039508.03.1C883CF Received: from mail-oi1-f196.google.com (mail-oi1-f196.google.com [209.85.167.196]) by imf31.hostedemail.com (Postfix) with ESMTP id BF15620071 for ; Sat, 30 Apr 2022 22:49:41 +0000 (UTC) Received: by mail-oi1-f196.google.com with SMTP id r1so11887146oie.4 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=u18wfrSkKSNkpxdPFKd4cgqU4kM35rWbzwKU9qYX7zcVs4gV8J7JCS8udDm1tw2YMO cTNl3p7YZlecp6BSO5eSKWru844mfV4+u1Jf3QG4cHoabwgGUoCRsTf4Du+qKl9pxxbT soQiaguK06A0D5ip8P0xE2QhWMmrw8su/k+HXyhDa6LCgyS+b+O46fj2Xm3MEgzW4JjP 51K8xqeVCGoUCIQ2zq/n/imC09f7BBYN8JS5d512nys5nfSu9BP36pwZDo9sOc0l579+ +yKP4WHLtu6jsthabhnOkP7fP1WemA4Oa54YwsU3Ojm0qt53S9FqTa/uQezlYfx39y5K 3/GA== X-Gm-Message-State: AOAM530WKb+faniB+l5idtTanpBpSN6zTzk0lvk7jFGaIevgBXK2AC0b Dx2Te7gEQb9SNcBGg6bYZTA= 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 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BF15620071 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="d7lqz/KT"; spf=pass (imf31.hostedemail.com: domain of remckee0@gmail.com designates 209.85.167.196 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Stat-Signature: brq55sjua96mtnrows4hyeitue6en5z7 X-HE-Tag: 1651358981-908878 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001497, 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. 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/memblock/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 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) { @@ -124,11 +130,21 @@ 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. + * 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) } /* - * 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. + * 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) } /* - * 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. + * 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) } /* - * 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) {