From mboxrd@z Thu Jan 1 00:00:00 1970 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 50AF1C433F5 for ; Thu, 21 Apr 2022 07:14:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7CF36B0071; Thu, 21 Apr 2022 03:14:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2D336B0078; Thu, 21 Apr 2022 03:14:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1B206B007B; Thu, 21 Apr 2022 03:14:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id A342E6B0071 for ; Thu, 21 Apr 2022 03:14:32 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 762F862FF9 for ; Thu, 21 Apr 2022 07:14:32 +0000 (UTC) X-FDA: 79380023184.04.085CBFE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 502C980026 for ; Thu, 21 Apr 2022 07:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650525270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FTKdRZp+dCYF2kvJ3QkbPTv+NjUqYK/0QAd8tz4f2u8=; b=fwcFmvP+2ITOd/Yhvoo7IEz9naStgPlf3NoR5fAC9MzToQWOrl+PZvMdfD/vT5X0FCYtVP WJBmxn2auu6sayZDv79RI8VUjFCHBqDKhsWlM2lHafOVf7JiSX7Yzf8QjsBPiq4AHgN94y fVI+woHkmVcGSviFfjTGiXVeW6zsBhs= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-kM1foFsMOCC9lboGbw9tVQ-1; Thu, 21 Apr 2022 03:14:29 -0400 X-MC-Unique: kM1foFsMOCC9lboGbw9tVQ-1 Received: by mail-wm1-f71.google.com with SMTP id v191-20020a1cacc8000000b0038ce818d2efso1990262wme.1 for ; Thu, 21 Apr 2022 00:14:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=FTKdRZp+dCYF2kvJ3QkbPTv+NjUqYK/0QAd8tz4f2u8=; b=FqgZqF1ntoqXzkrsFo166oHvUKKFOCCJeMBPodVbd9sqtlZ4YCAXCm1q68JX1iGtf1 Ww+7RvCGIbR9wRj1LmKE+aCUptf78up7s3vekbnzE9klKKtelWzSTfOm6qVhUnfDyRLN 2h+1PoNReLF9yxXFk7fc1i8+TDDUX1rgGIQqcW1q3o3DIq/eiM5IdKHhQrICAp8mlGg7 SRoLzh45uooQi+j6XZolXvw/YzG4TSM1W9Y/30Cj+HLHN8+sTFeRKXboM1QKYYvnFodq wKsOrHQ0Lp4Ss/PBnZKdR4+TRKuWzkqNOSOvBFUtvhCEFyQWkTy3ttux+3xzNu2mpd4+ XB+g== X-Gm-Message-State: AOAM531WgWg/5ZGrrRfP9K5gKsI4x8Y8F/gyqk83I49g72AOd18yU/fK 8ENA810LVCEMDUU0q/krtILwa7LJvoThkAaBCWHetufgQWQ7nBq4KpqoQD+XSfIkftPkDWRLzCA ezCjX4aZIUhk= X-Received: by 2002:adf:f244:0:b0:20a:c3ab:d009 with SMTP id b4-20020adff244000000b0020ac3abd009mr175580wrp.10.1650525267866; Thu, 21 Apr 2022 00:14:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywysQg8deQDrJHLZkyZ0rGqd8PFDbr2+HfodlCIi36M8eMOx80bbK9Gp7P+kUPy4LdLLRgEA== X-Received: by 2002:adf:f244:0:b0:20a:c3ab:d009 with SMTP id b4-20020adff244000000b0020ac3abd009mr175558wrp.10.1650525267563; Thu, 21 Apr 2022 00:14:27 -0700 (PDT) Received: from ?IPV6:2003:cb:c702:de00:711b:76af:b335:9b70? (p200300cbc702de00711b76afb3359b70.dip0.t-ipconnect.de. [2003:cb:c702:de00:711b:76af:b335:9b70]) by smtp.gmail.com with ESMTPSA id r9-20020a05600c320900b0038f0894d80csm1282777wmp.7.2022.04.21.00.14.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Apr 2022 00:14:26 -0700 (PDT) Message-ID: <02765252-2a86-f1aa-a7a1-b00e015e68a1@redhat.com> Date: Thu, 21 Apr 2022 09:14:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH 2/3] memblock tests: update style of comments for memblock_reserve_*() functions To: Rebecca Mckeever , outreachy@lists.linux.dev Cc: Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <6f385ad37eeb81331f9556fdddeced80ae32bded.1650452552.git.remckee0@gmail.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <6f385ad37eeb81331f9556fdddeced80ae32bded.1650452552.git.remckee0@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 502C980026 X-Stat-Signature: a7hsn5dcesehjy5ewirxibtod9cdb766 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=fwcFmvP+; spf=none (imf30.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-HE-Tag: 1650525268-533264 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: On 20.04.22 13:19, Rebecca Mckeever wrote: > 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. > > Signed-off-by: Rebecca Mckeever > --- > tools/testing/memblock/tests/basic_api.c | 70 +++++++++++++++++------- > 1 file changed, 51 insertions(+), 19 deletions(-) > > diff --git a/tools/testing/memblock/tests/basic_api.c b/tools/testing/memblock/tests/basic_api.c > index cdf112d25343..834d8705ff8a 100644 > --- a/tools/testing/memblock/tests/basic_api.c > +++ b/tools/testing/memblock/tests/basic_api.c > @@ -306,8 +306,8 @@ static int memblock_add_checks(void) > /* > * 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. > + * (memblock.reserved). Expect to create a new entry. The region counter > + * and total memory size are updated. > */ As mentioned in reply to patch #3, we try avoiding introducing "more wrong style" and cleanup afterwards. Cleanup first or along the way. > static int memblock_reserve_simple_check(void) > { > @@ -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) > { > @@ -411,10 +425,19 @@ 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. > + * > + * | +--------------+--+--------------+ | > + * | | 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) > { > @@ -451,9 +474,18 @@ 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. > + * > + * | +-----+--+---------------------------| > + * | | |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) Apart from that Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb