* [PATCH 1/1] mm/damon/core: Remove unnecessary zero-initialization in damon_new_ctx()
@ 2026-10-16 14:37 Adrian Huang (Lenovo)
2026-10-16 15:08 ` SJ Park
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Huang (Lenovo) @ 2026-10-16 14:37 UTC (permalink / raw)
To: SJ Park
Cc: Andrew Morton, damon, linux-mm, linux-kernel, ahuang12,
Adrian Huang (Lenovo)
damon_new_ctx() allocates the context structure using kzalloc(),
which already initializes all fields to zero.
The explicit initialization of passed_sample_intervals,
next_aggregation_sis, and next_ops_update_sis is therefore redundant.
In addition, they are later initialized by kdamond_init_ctx() before use.
Remove the unnecessary assignments to simplify the code.
Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
---
mm/damon/core.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index b63e60ef8990..74e6022ca137 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -918,11 +918,6 @@ struct damon_ctx *damon_new_ctx(void)
ctx->attrs.aggr_interval = 100 * 1000;
ctx->attrs.ops_update_interval = 60 * 1000 * 1000;
- ctx->passed_sample_intervals = 0;
- /* These will be set from kdamond_init_ctx() */
- ctx->next_aggregation_sis = 0;
- ctx->next_ops_update_sis = 0;
-
mutex_init(&ctx->kdamond_lock);
INIT_LIST_HEAD(&ctx->call_controls);
mutex_init(&ctx->call_controls_lock);
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] mm/damon/core: Remove unnecessary zero-initialization in damon_new_ctx()
2026-10-16 14:37 [PATCH 1/1] mm/damon/core: Remove unnecessary zero-initialization in damon_new_ctx() Adrian Huang (Lenovo)
@ 2026-10-16 15:08 ` SJ Park
0 siblings, 0 replies; 2+ messages in thread
From: SJ Park @ 2026-10-16 15:08 UTC (permalink / raw)
To: Adrian Huang (Lenovo)
Cc: SJ Park, Andrew Morton, damon, linux-mm, linux-kernel, ahuang12
Hello Adrian,
Let's use lowercase for the first word of the subject (s/Remove/remove/), as
that's the convention in mm.
On Fri, 16 Oct 2026 22:37:33 +0800 "Adrian Huang (Lenovo)" <adrianhuang0701@gmail.com> wrote:
> damon_new_ctx() allocates the context structure using kzalloc(),
> which already initializes all fields to zero.
>
> The explicit initialization of passed_sample_intervals,
> next_aggregation_sis, and next_ops_update_sis is therefore redundant.
> In addition, they are later initialized by kdamond_init_ctx() before use.
>
> Remove the unnecessary assignments to simplify the code.
Makes sense, thank you for this patch.
>
> Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
I applied this patch to damon/next [1] tree after adjusting the subject as I
abovely mentioned. Let me know if you dislike the change. We are now quite
close to next merge window. It may better to focus on making mm.git more
stabilized and therefore ready for the next merge window, rather than adding
more changes that are not really urgent. I understand this series is not
really urgent. Hence, Andrew might not add this patch until next -rc1 release.
In the case, I will request adding this to mm.git after next -rc1 release. So,
no action from your side is needed for now. Let me know if you think this is
really urgent.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-16 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 14:37 [PATCH 1/1] mm/damon/core: Remove unnecessary zero-initialization in damon_new_ctx() Adrian Huang (Lenovo)
2026-10-16 15:08 ` SJ Park
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).