* [PATCH] mm/damon/dbgfs: Use kmalloc for allocating only one element
@ 2022-08-08 22:00 Kenneth Lee
2022-08-11 0:52 ` SeongJae Park
0 siblings, 1 reply; 2+ messages in thread
From: Kenneth Lee @ 2022-08-08 22:00 UTC (permalink / raw)
To: akpm; +Cc: damon, Kenneth Lee
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/damon/dbgfs: Use kmalloc for allocating only one element
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
0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2022-08-11 0:52 UTC (permalink / raw)
To: Kenneth Lee; +Cc: akpm, damon, SeongJae Park
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-11 0:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox