Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp744688pxb; Fri, 22 Apr 2022 10:15:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9NuBpHynX49wYTzhuAFVYCXCD3YfvZEo7hjcxRSCLTbWeVL1Tx4LmuyfSRFplx0Amr2G3 X-Received: by 2002:a17:902:704b:b0:15c:42fb:e5b with SMTP id h11-20020a170902704b00b0015c42fb0e5bmr3318324plt.79.1650647700051; Fri, 22 Apr 2022 10:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650647700; cv=none; d=google.com; s=arc-20160816; b=YqosJqjE4DFNXTvdiBmV1u65EwIfHwbrJIIWtwApYvPKG0kr5f3NbkHFwgK8kv1mjg yXKHEEWvwaz8RlHgLLAKK74bjHlruqzltnRlDN3ur90/yBZ56KJFiarByoXsQ7h4D/DH REkNGOau+M3iTVRzEb3vhm3HPadT7sIM65teDyXGs0pbfvEJauvX7GjdjVT5yfZi7pKD O942QcJQfVvKdYTvtyj6bw8YX7TgVw1xS3+ybWbu3zgNbXGkNaYxlaLIm6QTihzOuyPm +gOA4/o+AGO9+cEa/JINPQ1QNCfhZD52VfIH1eRM7dojRkcK9tUDaET7lQBX+uut6le0 q9ww== 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=XlCh/TROTMgIT0UvKXK2lUbRlqfaTVRDW2LmfRt6iMQ=; b=yFwF6pUmFrZBYT6x1wnvRlTQciK2xgOrCRiil47Rbb5p0uqHgirvKkqaefwOCsvnWh lc/UdghQ/UKRjUb+hS1Fu7Zl65bt0ZM2bxiFvCGHk2NRieg/ZxdeTSEWB0/ApOhYkLRl R8QKfs5AnfGlK6O4dDjiXGXC9zrZjcEN7KfFXdIm6wM9sxddGGWGjRhiwZDiI9GIj/0J LLYMtAjLqxP9UxG+6D3dVBqS16fi+G2Y11JxRf7MN38RhobzAkVAu892jJDVXKQPYg/o 1jHH6WIqE1MjzRkj8PQj3SuUw1gsKsjqsTzJcNvIUZ/qAtRCFf49rwTa1nwY3rDNw6Et agyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iaxa/qlk"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id i5-20020a1709026ac500b001565a006f53si7969947plt.404.2022.04.22.10.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:15:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iaxa/qlk"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C01CA27F5; Fri, 22 Apr 2022 10:13:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447923AbiDVNgQ (ORCPT + 99 others); Fri, 22 Apr 2022 09:36:16 -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-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: 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_reserve_*() functions to match the style used in tests/alloc_*.c by rewording to make the expected outcome more apparent and, if more than one memblock is involved, adding a visual of the memory blocks. If the comment has an extra column of spaces, remove the extra space at the beginning of each line for consistency and to conform to Linux kernel coding style. Signed-off-by: Rebecca Mckeever --- tools/testing/memblock/tests/basic_api.c | 82 ++++++++++++++++-------- 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c index e96be0319ad4..75cd7479ee54 100644 --- a/tools/testing/memblock/tests/basic_api.c +++ b/tools/testing/memblock/tests/basic_api.c @@ -303,12 +303,12 @@ static int memblock_add_checks(void) return 0; } - /* - * A simple test that marks a memory block of a specified base address - * and size as reserved and to the collection of reserved memory regions - * (memblock.reserved). It checks if a new entry was created and if region - * counter and total memory size were correctly updated. - */ +/* + * A simple test that marks a memory block of a specified base address + * and size as reserved and to the collection of reserved memory regions + * (memblock.reserved). Expect to create a new entry. The region counter + * and total memory size are updated. + */ static int memblock_reserve_simple_check(void) { struct memblock_region *rgn; @@ -330,10 +330,15 @@ static int memblock_reserve_simple_check(void) } /* - * A test that tries to mark two memory blocks that don't overlap as reserved - * and checks if two entries were correctly added to the collection of reserved - * memory regions (memblock.reserved) and if this change was reflected in - * memblock.reserved's total size and region counter. + * A test that tries to mark two memory blocks that don't overlap as reserved: + * + * | +--+ +----------------+ | + * | |r1| | r2 | | + * +--------+--+------+----------------+--+ + * + * Expect to add two entries to the collection of reserved memory regions + * (memblock.reserved). The total size and region counter for + * memblock.reserved are updated. */ static int memblock_reserve_disjoint_check(void) { @@ -370,11 +375,20 @@ static int memblock_reserve_disjoint_check(void) /* * A test that tries to mark two memory blocks as reserved, where the * second one overlaps with the beginning of the first (that is - * r1.base < r2.base + r2.size). - * It checks if two entries are merged into one region that starts at r2.base - * and has size of two regions minus their intersection. The test also verifies - * that memblock can still see only one entry and has a correct total size of - * the reserved memory. + * r1.base < r2.base + r2.size): + * + * | +--------------+--+--------------+ | + * | | r2 | | r1 | | + * +--+--------------+--+--------------+--+ + * ^ ^ + * | | + * | r1.base + * | + * r2.base + * + * Expect to merge two entries into one region that starts at r2.base and + * has size of two regions minus their intersection. The total size of the + * reserved memory is updated, and the region counter is not updated. */ static int memblock_reserve_overlap_top_check(void) { @@ -410,11 +424,20 @@ static int memblock_reserve_overlap_top_check(void) /* * A test that tries to mark two memory blocks as reserved, where the * second one overlaps with the end of the first entry (that is - * r2.base < r1.base + r1.size). - * It checks if two entries are merged into one region that starts at r1.base - * and has size of two regions minus their intersection. It verifies that - * memblock can still see only one entry and has a correct total size of the - * reserved memory. + * r2.base < r1.base + r1.size): + * + * | +--------------+--+--------------+ | + * | | r1 | | r2 | | + * +--+--------------+--+--------------+--+ + * ^ ^ + * | | + * | r2.base + * | + * r1.base + * + * Expect to merge two entries into one region that starts at r1.base and + * has size of two regions minus their intersection. The total size of the + * reserved memory is updated, and the region counter is not updated. */ static int memblock_reserve_overlap_bottom_check(void) { @@ -450,10 +473,19 @@ static int memblock_reserve_overlap_bottom_check(void) /* * A test that tries to mark two memory blocks as reserved, where the second * one is within the range of the first entry (that is - * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)). - * It checks if two entries are merged into one region that stays the - * same. The counter and total size of available memory are expected to not be - * updated. + * (r1.base < r2.base) && (r2.base + r2.size < r1.base + r1.size)): + * + * | +-----+--+---------------------------| + * | | |r2| r1 | + * +-+-----+--+---------------------------+ + * ^ ^ + * | | + * | r2.base + * | + * r1.base + * + * Expect to merge two entries into one region that stays the same. The + * counter and total size of available memory are not updated. */ static int memblock_reserve_within_check(void) { @@ -485,7 +517,7 @@ static int memblock_reserve_within_check(void) /* * A simple test that tries to reserve the same memory block twice. - * The region counter and total size of reserved memory are expected to not + * Expect the region counter and total size of reserved memory to not * be updated. */ static int memblock_reserve_twice_check(void) -- 2.32.0