outreachy.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Rebecca Mckeever <remckee0@gmail.com>, outreachy@lists.linux.dev
Cc: Mike Rapoport <rppt@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] memblock tests: update style of comments for memblock_reserve_*() functions
Date: Thu, 21 Apr 2022 09:14:25 +0200	[thread overview]
Message-ID: <02765252-2a86-f1aa-a7a1-b00e015e68a1@redhat.com> (raw)
In-Reply-To: <6f385ad37eeb81331f9556fdddeced80ae32bded.1650452552.git.remckee0@gmail.com>

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 <remckee0@gmail.com>
> ---
>  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 <david@redhat.com>

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2022-04-21  7:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 11:18 [PATCH 0/3] memblock tests: update style of comments Rebecca Mckeever
2022-04-20 11:19 ` [PATCH 1/3] memblock tests: update style of comments for memblock_add_*() functions Rebecca Mckeever
2022-04-21  7:12   ` David Hildenbrand
2022-04-21 14:34     ` Mike Rapoport
2022-04-20 11:19 ` [PATCH 2/3] memblock tests: update style of comments for memblock_reserve_*() functions Rebecca Mckeever
2022-04-21  7:14   ` David Hildenbrand [this message]
2022-04-20 11:19 ` [PATCH 3/3] memblock tests: remove extra column of spaces in block comment Rebecca Mckeever
2022-04-21  7:09   ` David Hildenbrand
2022-04-21 14:42     ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02765252-2a86-f1aa-a7a1-b00e015e68a1@redhat.com \
    --to=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=outreachy@lists.linux.dev \
    --cc=remckee0@gmail.com \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).