From: SeongJae Park <sj@kernel.org>
To: Kenneth Lee <klee33@uw.edu>
Cc: akpm@linux-foundation.org, damon@lists.linux.dev,
SeongJae Park <sj@kernel.org>
Subject: Re: [PATCH] mm/damon/dbgfs: Use kmalloc for allocating only one element
Date: Thu, 11 Aug 2022 00:52:41 +0000 [thread overview]
Message-ID: <20220811005241.51597-1-sj@kernel.org> (raw)
In-Reply-To: <20220808220019.1680469-1-klee33@uw.edu>
Hi Kenneth,
Thanks for this patch, and sorry for this late reply.
On Mon, 8 Aug 2022 15:00:19 -0700 Kenneth Lee <klee33@uw.edu> wrote:
> Use kmalloc(...) rather than kmalloc_array(1, ...) because the number of
> elements we are specifying in this case is 1, kmalloc would accomplish the
> same thing and we can simplify.
>
> Signed-off-by: Kenneth Lee <klee33@uw.edu>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> mm/damon/dbgfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index cb8a7e9926a4..51d67c8050dd 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -1041,7 +1041,7 @@ static int __init __damon_dbgfs_init(void)
> fops[i]);
> dbgfs_fill_ctx_dir(dbgfs_root, dbgfs_ctxs[0]);
>
> - dbgfs_dirs = kmalloc_array(1, sizeof(dbgfs_root), GFP_KERNEL);
> + dbgfs_dirs = kmalloc(sizeof(dbgfs_root), GFP_KERNEL);
> if (!dbgfs_dirs) {
> debugfs_remove(dbgfs_root);
> return -ENOMEM;
> --
> 2.31.1
prev parent reply other threads:[~2022-08-11 0:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-08 22:00 [PATCH] mm/damon/dbgfs: Use kmalloc for allocating only one element Kenneth Lee
2022-08-11 0:52 ` SeongJae Park [this message]
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=20220811005241.51597-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=klee33@uw.edu \
/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