From: Mike Rapoport <rppt@kernel.org>
To: Rebecca Mckeever <remckee0@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
David Hildenbrand <david@redhat.com>,
Shaoqin Huang <shaoqin.huang@intel.com>
Subject: Re: [PATCH v2 1/8] memblock tests: update tests to check if memblock_alloc zeroed memory
Date: Tue, 23 Aug 2022 16:25:24 +0300 [thread overview]
Message-ID: <YwTVRHXslU4aW52G@kernel.org> (raw)
In-Reply-To: <669782f4f508c3dd60c5efd6d130d12a77573448.1660897732.git.remckee0@gmail.com>
On Fri, Aug 19, 2022 at 01:34:49AM -0700, Rebecca Mckeever wrote:
> Add an assert in memblock_alloc() tests where allocation is expected to
> occur. The assert checks whether the entire chunk of allocated memory is
> cleared.
>
> The current memblock_alloc() tests do not check whether the allocated
> memory was zeroed. memblock_alloc() should zero the allocated memory since
> it is a wrapper for memblock_alloc_try_nid().
>
> Reviewed-by: Shaoqin Huang <shaoqin.huang@intel.com>
> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
> ---
> tools/testing/memblock/tests/alloc_api.c | 23 +++++++++++++++++++++++
> tools/testing/memblock/tests/common.c | 7 +++++++
> tools/testing/memblock/tests/common.h | 12 ++++++++++++
> 3 files changed, 42 insertions(+)
>
> diff --git a/tools/testing/memblock/tests/alloc_api.c b/tools/testing/memblock/tests/alloc_api.c
> index a14f38eb8a89..aefb67557de9 100644
> --- a/tools/testing/memblock/tests/alloc_api.c
> +++ b/tools/testing/memblock/tests/alloc_api.c
> @@ -22,6 +22,8 @@ static int alloc_top_down_simple_check(void)
> allocated_ptr = memblock_alloc(size, SMP_CACHE_BYTES);
>
> ASSERT_NE(allocated_ptr, NULL);
> + ASSERT_MEM_EQ((char *)allocated_ptr, 0, size);
> +
Can we please hide the casting inside ASSERT_MEM_EQ()?
Like if ASSERT_MEM_EQ() were a function its declaration would be
bool ASSERT_MEM_EQ(void *mem, char val, size_t size);
> ASSERT_EQ(rgn->size, size);
> ASSERT_EQ(rgn->base, expected_start);
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2022-08-23 13:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 8:34 [PATCH v2 0/8] memblock tests: update and extend memblock simulator Rebecca Mckeever
2022-08-19 8:34 ` [PATCH v2 3/8] memblock tests: add labels to verbose output for generic alloc tests Rebecca Mckeever
2022-08-23 9:37 ` David Hildenbrand
[not found] ` <669782f4f508c3dd60c5efd6d130d12a77573448.1660897732.git.remckee0@gmail.com>
2022-08-23 9:36 ` [PATCH v2 1/8] memblock tests: update tests to check if memblock_alloc zeroed memory David Hildenbrand
2022-08-23 13:25 ` Mike Rapoport [this message]
[not found] ` <c15e2b50ba481647e5fe9fd0be92af0768f35356.1660897732.git.remckee0@gmail.com>
2022-08-23 9:39 ` [PATCH v2 4/8] memblock tests: add additional tests for basic api and memblock_alloc David Hildenbrand
[not found] ` <48cfb01ba417895f28ce7ef9b99d1ce0854bfd5e.1660897732.git.remckee0@gmail.com>
2022-08-23 9:49 ` [PATCH v2 5/8] memblock tests: update alloc_api to test memblock_alloc_raw David Hildenbrand
2022-08-25 21:35 ` Rebecca Mckeever
2022-08-26 9:28 ` David Hildenbrand
[not found] ` <c8d86890f5b7168a162c9aee867e338b76e1cf0b.1660897732.git.remckee0@gmail.com>
2022-08-23 9:50 ` [PATCH v2 6/8] memblock tests: update alloc_nid_api to test memblock_alloc_try_nid_raw David Hildenbrand
[not found] ` <4157021eecdd3abb503d4b1d1449844baac2d7b9.1660897732.git.remckee0@gmail.com>
2022-08-23 9:54 ` [PATCH v2 8/8] memblock tests: add tests for memblock_trim_memory David Hildenbrand
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=YwTVRHXslU4aW52G@kernel.org \
--to=rppt@kernel.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=remckee0@gmail.com \
--cc=shaoqin.huang@intel.com \
/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).