From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE75C83F1D for ; Sat, 12 Jul 2025 19:51:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CCE96B00CE; Sat, 12 Jul 2025 15:50:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67EAD6B00CF; Sat, 12 Jul 2025 15:50:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56CB46B00D0; Sat, 12 Jul 2025 15:50:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 42D8F6B00CE for ; Sat, 12 Jul 2025 15:50:39 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 16DCEB7B33 for ; Sat, 12 Jul 2025 19:50:39 +0000 (UTC) X-FDA: 83656654998.04.67048BA Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 63C811C000D for ; Sat, 12 Jul 2025 19:50:37 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jI3qg08J; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752349837; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u7PebqOyozv9dtKmc7AvFFgxMuiJrQo4VUkfAFp9rcQ=; b=uEpWYajlRCQQVrNxbLLxLLTrdbgJ2XYIBhDTgjcUM3Cq3pjw4HitvFn8wCrS/Sxlsw1iXa gWKa0nv9FdfU4Vb5dKFGroOllllrLBmJlMlOhC4e2ymSiI6HsrYg4nb8OxT6gCS2ohWFJb IrCOVZuXeCHx5zR0BpkoUHazGgYx2G0= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jI3qg08J; spf=pass (imf18.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752349837; a=rsa-sha256; cv=none; b=wXpeJW4NcdtjBK38VMCfrCVXIBK7HlSj/eE2qEzjiG2j7e8IgZn65PqfB5/SF1qdcvSmdB Vmd7F3UD0Hkc4QInZNnb2E/OtMTH/Jg9dM6QgURgkvcMNAD/mymk6Wr2LrGkVtAokwDd0m CidaFcD5gB+MP45I2Bic3zdNR3fRflo= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AAA7B5C4125; Sat, 12 Jul 2025 19:50:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23DA8C4CEF1; Sat, 12 Jul 2025 19:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752349836; bh=N6UgM+GaU7C25cINsCnFK+jRBTnhXf4uYeOYOmlqYds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jI3qg08JH6ttnI0W7A3bfseSky7pZofrGzwYc23N1TYIhYlE50n3BH3z0aleDvYIL kVvS56Apd0e1nEiBhzPjcLz5g2vQPEdiIBivrjAU61AAWaPDBgbQt6iivdKxQvQAS3 agMj7LmG+f+kKCQPh9IgGiWrBdpHy1Izu248+N8QXR+7eV4FQb2ALB3fVlKTeZtHuy 7zbGBW5g82RZtaTtfczGkMs6L2ReRL5a94IIJWpjna/XZtPBBbMcV3KcFIcZfuNlGM d9K3EPVqvl6T0H2/DqgmKTg36JYgkcgOPSi3RtxuXyIEi55drBeAYkhpsV6m/TYFrL 2bGhRqQG30ZsA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 14/14] mm/damon/core: remove damon_callback Date: Sat, 12 Jul 2025 12:50:16 -0700 Message-Id: <20250712195016.151108-15-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250712195016.151108-1-sj@kernel.org> References: <20250712195016.151108-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 63C811C000D X-Stat-Signature: zfktfeqnzr1hhzipa3oy7wpw88ms7ar7 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1752349837-352325 X-HE-Meta: U2FsdGVkX1/GAws+EPWNAnSGzCSNxg/BSAbzpeQ07bseyYgRy9emt2MsZyW6D5HxCm1Ejc1teL2p9KD0kLSN2KUWFm2ZtTBHc19InwuKr30B7/jxZ99JJ7+/RfpG7jqHO7Z2LRU+wOOk72V+P8+S8aCeai35FbKyJSZOxGJE26slQ/mJiE2l7k4yFSQZbMZbgEOa5y1X9n/xodvPwtD42ynD4kN9PKNScCYHh1f2tbuJ+iuRbuDVzPsE6NqKpf3AcJ5XaxRVQgOF/CePm40qLf2cmA9C3p/WAAjpi5a+WQz9aZnJYBSuoE36O9enmTGiN7zfVilkkPeDjD25zqFIukupdRhCYWk1kCYGW/qnSvU8iJbeZXdzlM5KMlD7+UhaJ4Aq5ebhPy/HfAYcKPAygBfX7YFgwMlxLso5qyqnG3sDXKyqSSIMUP5N7RpCAXjv2NvMS9SGh1MKlDM5abpqJLp0h4A9lBCHpMApkF4awsSnsjoWHbWiAwpG75CrfsI+JpXvjRsZw4RnEII5zeKug5HOifJGhRQ+1QHGstIkyai+D4V+kcaHDeWurhPWKluIYvcGygEGuPlr1Qr3SFKbfTCrF6hvjf9Fpo+p9YvCp0A1wlxvhOSLorqeTEdjK18IW5ZuEfRAlAWG61+XdgSzJQp381sjbUm7RVGIHb6RWoBPTuPJ5UgFigR8LoLxExswVEbW+nkWYKt2U+tRHN5gidRaMk19/ceKYUCayBP28LPSpRov6N6z6MqxTYaxfiKagmzK7ZJL939/bL8Q4m+HHMYh3DZA1731Jh2KfKg2Visit2kb1GSgV+qolAnXtAjFmO9ZVltdePEgCUeLshaGfTodCuz5gjR+oS262Z0Ert9m86aOeJbhRVcY2CREZ5RA+iH5SsSJ8sj8/azyzQzvLg399tNJZ/hbafKta2yf1lwGp8QS107lRyT8X6K23DjoncpZfbkyvSuaEH3Fj41 FbxgVkoc bYT08KcrYu8lKsOSRxCbGlL4eIcdY5GpmiOIcdAqJNqspA1yy8YArkhIgSSqMuQ5VpUCyo5/XIKsqUElDa/R7+3d9HrjnAZPB52pAlkDzGcosM3D5iOWF0OjY/5TbVTJzfqwMfkBGHaASBZfHEkG3Mu6aAKq+fZVLdvML8HoGnYPx52j5xNaJ9yZ+5CYevrb4dW3pqGkkXewOcULRHdJv8E3AvedClrXRXhzKX2HXL4hgeNClxROOZTnyb4vsmVUzI+niioQyuJxgP71UCsyLXttpyQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: All damon_callback usages are replicated by damon_call() and damos_walk(). Time to say goodbye. Remove damon_callback. Signed-off-by: SeongJae Park --- include/linux/damon.h | 31 +------------------------------ mm/damon/core.c | 26 +++++++------------------- 2 files changed, 8 insertions(+), 49 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 27305d39f600..34fc5407f98e 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -628,34 +628,6 @@ struct damon_operations { void (*cleanup)(struct damon_ctx *context); }; -/** - * struct damon_callback - Monitoring events notification callbacks. - * - * @after_wmarks_check: Called after each schemes' watermarks check. - * @after_aggregation: Called after each aggregation. - * @before_terminate: Called before terminating the monitoring. - * - * The monitoring thread (&damon_ctx.kdamond) calls @before_terminate just - * before finishing the monitoring. - * - * The monitoring thread calls @after_wmarks_check after each DAMON-based - * operation schemes' watermarks check. If users need to make changes to the - * attributes of the monitoring context while it's deactivated due to the - * watermarks, this is the good place to do. - * - * The monitoring thread calls @after_aggregation for each of the aggregation - * intervals. Therefore, users can safely access the monitoring results - * without additional protection. For the reason, users are recommended to use - * these callback for the accesses to the results. - * - * If any callback returns non-zero, monitoring stops. - */ -struct damon_callback { - int (*after_wmarks_check)(struct damon_ctx *context); - int (*after_aggregation)(struct damon_ctx *context); - void (*before_terminate)(struct damon_ctx *context); -}; - /* * struct damon_call_control - Control damon_call(). * @@ -726,7 +698,7 @@ struct damon_intervals_goal { * ``mmap()`` calls from the application, in case of virtual memory monitoring) * and applies the changes for each @ops_update_interval. All time intervals * are in micro-seconds. Please refer to &struct damon_operations and &struct - * damon_callback for more detail. + * damon_call_control for more detail. */ struct damon_attrs { unsigned long sample_interval; @@ -816,7 +788,6 @@ struct damon_ctx { struct mutex kdamond_lock; struct damon_operations ops; - struct damon_callback callback; struct list_head adaptive_targets; struct list_head schemes; diff --git a/mm/damon/core.c b/mm/damon/core.c index ffd1a061c2cb..f3ec3bd736ec 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -680,9 +680,7 @@ static bool damon_valid_intervals_goal(struct damon_attrs *attrs) * @attrs: monitoring attributes * * This function should be called while the kdamond is not running, an access - * check results aggregation is not ongoing (e.g., from &struct - * damon_callback->after_aggregation or &struct - * damon_callback->after_wmarks_check callbacks), or from damon_call(). + * check results aggregation is not ongoing (e.g., from damon_call(). * * Every time interval is in micro-seconds. * @@ -778,7 +776,7 @@ static void damos_commit_quota_goal( * DAMON contexts, instead of manual in-place updates. * * This function should be called from parameters-update safe context, like - * DAMON callbacks. + * damon_call(). */ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src) { @@ -1177,7 +1175,7 @@ static int damon_commit_targets( * in-place updates. * * This function should be called from parameters-update safe context, like - * DAMON callbacks. + * damon_call(). */ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src) { @@ -2484,9 +2482,6 @@ static int kdamond_wait_activation(struct damon_ctx *ctx) kdamond_usleep(min_wait_time); - if (ctx->callback.after_wmarks_check && - ctx->callback.after_wmarks_check(ctx)) - break; kdamond_call(ctx, false); damos_walk_cancel(ctx); } @@ -2543,10 +2538,9 @@ static int kdamond_fn(void *data) while (!kdamond_need_stop(ctx)) { /* * ctx->attrs and ctx->next_{aggregation,ops_update}_sis could - * be changed from after_wmarks_check() or after_aggregation() - * callbacks. Read the values here, and use those for this - * iteration. That is, damon_set_attrs() updated new values - * are respected from next iteration. + * be changed from kdamond_call(). Read the values here, and + * use those for this iteration. That is, damon_set_attrs() + * updated new values are respected from next iteration. */ unsigned long next_aggregation_sis = ctx->next_aggregation_sis; unsigned long next_ops_update_sis = ctx->next_ops_update_sis; @@ -2564,14 +2558,10 @@ static int kdamond_fn(void *data) if (ctx->ops.check_accesses) max_nr_accesses = ctx->ops.check_accesses(ctx); - if (ctx->passed_sample_intervals >= next_aggregation_sis) { + if (ctx->passed_sample_intervals >= next_aggregation_sis) kdamond_merge_regions(ctx, max_nr_accesses / 10, sz_limit); - if (ctx->callback.after_aggregation && - ctx->callback.after_aggregation(ctx)) - break; - } /* * do kdamond_call() and kdamond_apply_schemes() after @@ -2637,8 +2627,6 @@ static int kdamond_fn(void *data) damon_destroy_region(r, t); } - if (ctx->callback.before_terminate) - ctx->callback.before_terminate(ctx); if (ctx->ops.cleanup) ctx->ops.cleanup(ctx); kfree(ctx->regions_score_histogram); -- 2.39.5