Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp849380pxb; Fri, 22 Apr 2022 12:32:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmge80TdzYY1MzCUlmSnbYfS7oLWLd1sSt8INa/FohVF+3cnPQzeSU+3slR8ruW63V09lK X-Received: by 2002:a17:90a:5902:b0:1cb:a0eb:8f8c with SMTP id k2-20020a17090a590200b001cba0eb8f8cmr7050706pji.17.1650655939104; Fri, 22 Apr 2022 12:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650655939; cv=none; d=google.com; s=arc-20160816; b=zKz8hV2R7UwTkqYoO7ch8B7vwPAyKgClqZIPYfPM7vcGxjwR7wIsSvod3UxLXl32Wt vbx+o5zPB9R+DPm87RFn3Bcp3NE7Y2ME6Od7pTb0HGRBePdK1p7sHcSk/GBk4XSFA7rX ni11P+RhUwQxi19lSSq3T6d4CC96bk6CRti8BsjCbaF1+vRD0FolenoYANmTdCPbi8K/ iXsXRUvWvoK8NjtldjMKhsSxXu88b/JysvLC9JYSqZlHiRUARb6f5dd8MdaRqlmbx6eO /5mORIOjlBKDEDGCuIBagzFyRMF2IpPFSX4Sd0e/BEBaNec9Qrtp4Tdl8YtQh1ItxDdw vHhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SSzBkjMJuCHeJx2Pu4aS83z4goHTE74keZ/qqMMfuhA=; b=a3JKmx4x/a6X/UEAlua1MkOTxfKbQ0hyI4/TUVzOKpcm3yY/gk0JkHvf6hELBhU/ay KYKbNN59BU1tidh/VU5IHVUcfKAowEe0CLdtltzg3HxyeDcKoOMxHroDiMpSyizVwLhH 6JuRrHu+tfW7s329Ba+lgQE0fQae13EKxa/n5XJ/+OJRWN8blBnt/fHo/MPX7lmKTbgz 3DK7NxybN8cQxgIs0tebakxWB6Gg5+tqrexayXfiQ1Str+Y749RvaMZlbvMyyx+lWjBp sUsVbZVjbgkNhnQkuKrt1OeQAXTxJSElaUGRKuZOhvRjZ7MLHYn5/7XpntjJb67aj1NF D+LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pdXwU9el; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u20-20020a056a00159400b004fdada2b1d5si10282170pfk.327.2022.04.22.12.32.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pdXwU9el; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 32ADB6F9D8; Fri, 22 Apr 2022 11:41:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447891AbiDVNgN (ORCPT + 99 others); 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-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: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.32.0