mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Adrian Huang (Lenovo)" <adrianhuang0701@gmail.com>,
	SJ Park <sj@kernel.org>,
	damon@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: [PATCH 1/9] mm/damon/core: remove unnecessary zero-initialization in damon_new_ctx()
Date: Mon,  2 Nov 2026 07:07:48 -0800	[thread overview]
Message-ID: <20261102150757.93058-2-sj@kernel.org> (raw)
In-Reply-To: <20261102150757.93058-1-sj@kernel.org>

From: "Adrian Huang (Lenovo)" <adrianhuang0701@gmail.com>

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.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
Signed-off-by: SJ Park <sj@kernel.org>
---
Changes from v1
- v1: https://lore.kernel.org/20261016143733.320-1-adrianhuang0701@gmail.com
- Collect R-b: from SJ.
- Rebase to latest mm-new.

 mm/damon/core.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mm/damon/core.c b/mm/damon/core.c
index 7441cdea57dc5..9d54899004026 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.47.3

  reply	other threads:[~2026-11-02 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 15:07 [PATCH 0/9] mm/damon: various fixes and cleanup of code, test, and docs SJ Park
2026-11-02 15:07 ` SJ Park [this message]
2026-11-02 15:07 ` [PATCH 2/9] mm/damon/ops-common: align MMU notifier range when clearing PTE young bit SJ Park
2026-11-02 15:07 ` [PATCH 3/9] mm/damon/ops-common: align MMU notifier range when clearing PMD " SJ Park
2026-11-02 15:07 ` [PATCH 4/9] mm/damon/stat: avoid 32-bit overflow in idle percentiles SJ Park
2026-11-02 15:07 ` [PATCH 5/9] mm/damon/{p,v}addr: skip folios already on the migration target node SJ Park
2026-11-02 15:07 ` [PATCH 6/9] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test SJ Park
2026-11-02 15:07 ` [PATCH 7/9] mm/damon/reclaim: fix typo and grammar SJ Park
2026-11-02 15:07 ` [PATCH 8/9] Docs/admin-guide/mm/damon/lru_sort: fix grammar and stlye SJ Park
2026-11-02 15:07 ` [PATCH 9/9] Docs/admin-guide/mm/damon/reclaim: document how to disable watermarks SJ Park

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=20261102150757.93058-2-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=adrianhuang0701@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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

all inboxes | Powered by JetHome®