From patchwork Sat Apr 30 22:49:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rebecca Mckeever X-Patchwork-Id: 12833449 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 C2958C433EF for ; Sat, 30 Apr 2022 22:49:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 292866B0074; Sat, 30 Apr 2022 18:49:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 242716B0075; Sat, 30 Apr 2022 18:49:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 094426B0078; Sat, 30 Apr 2022 18:49:57 -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 F08196B0074 for ; Sat, 30 Apr 2022 18:49:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id D204460AF4 for ; Sat, 30 Apr 2022 22:49:56 +0000 (UTC) X-FDA: 79415039592.10.E76F425 Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by imf20.hostedemail.com (Postfix) with ESMTP id 98AC01C007C for ; Sat, 30 Apr 2022 22:49:51 +0000 (UTC) Received: by mail-ot1-f68.google.com with SMTP id g11-20020a9d648b000000b00605e4278793so6548908otl.7 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=udVOajYqM9TdppRrUPRq0dTgtvHKLOF3Mec62tA5Ic92JzvJ6P9e1pS89FluutBrUy yJOvh9Z4lTSf0+rFdCTVj2ktW+y99e3iHjRmt5RNq8tYBwvHJGunBgmxLWIstZQIWkjR bqDtKqQgaVgB3tWMAFF8SRnwhzq3pFQcrRC2ZxTWfH9zLLVHMcRmFq3qupZ0PC5hIWtl 0CBW/CijEbL7epNycijVNy28iDU7z6nnVWJPZ3hYkOhHh1GNzSeGk+QmJkbOH+wmAmac 65icokbWeZ924GxaYFRQwDZz2yiyM6SgB+gLC03wLqGdfjQ08VP5cDsr9LOhmnfAf5uF IPBg== X-Gm-Message-State: AOAM530bLIP10YOfgTEMxkV6tdAXnFUqHv6MPTjVLxKeqnYjJVGh+inl 1vsx/nudt6eZrnUqEn9oNSQ= 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 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 98AC01C007C X-Stat-Signature: g94fjuh6t8kt4x9xjq4wpuuzkba3brwq Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ME9eSKKJ; spf=pass (imf20.hostedemail.com: domain of remckee0@gmail.com designates 209.85.210.68 as permitted sender) smtp.mailfrom=remckee0@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1651358991-786219 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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/memblock/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; } - /* - * 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) { @@ -368,13 +373,22 @@ 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. + * 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) } /* - * 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. + * 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) } /* - * 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. + * 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) /* * 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)