linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: SeongJae Park <sj@kernel.org>,
	damon@lists.linux.dev, kernel-team@meta.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH 07/13] mm/damon/sysfs: remove damon_sysfs_cmd_request and its readers
Date: Thu,  6 Mar 2025 09:59:02 -0800	[thread overview]
Message-ID: <20250306175908.66300-8-sj@kernel.org> (raw)
In-Reply-To: <20250306175908.66300-1-sj@kernel.org>

damon_sysfs_cmd_request is DAMON sysfs interface's own synchronization
mechanism for accessing DAMON internal data via damon_callback hooks.
All the users are now migrated to damon_call() and damos_walk(), so
nobody really uses it.  No one writes to the data structure but reading
code is still remained.  Remove the reading code and the entire data
structure.

Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/sysfs.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index e5bcf019086f..1af6aff35d84 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1238,25 +1238,6 @@ static const char * const damon_sysfs_cmd_strs[] = {
 	"update_tuned_intervals",
 };
 
-/*
- * struct damon_sysfs_cmd_request - A request to the DAMON callback.
- * @cmd:	The command that needs to be handled by the callback.
- * @kdamond:	The kobject wrapper that associated to the kdamond thread.
- *
- * This structure represents a sysfs command request that need to access some
- * DAMON context-internal data.  Because DAMON context-internal data can be
- * safely accessed from DAMON callbacks without additional synchronization, the
- * request will be handled by the DAMON callback.  None-``NULL`` @kdamond means
- * the request is valid.
- */
-struct damon_sysfs_cmd_request {
-	enum damon_sysfs_cmd cmd;
-	struct damon_sysfs_kdamond *kdamond;
-};
-
-/* Current DAMON callback request.  Protected by damon_sysfs_lock. */
-static struct damon_sysfs_cmd_request damon_sysfs_cmd_request;
-
 static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
 		char *buf)
 {
@@ -1555,8 +1536,6 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
 
 	if (damon_sysfs_kdamond_running(kdamond))
 		return -EBUSY;
-	if (damon_sysfs_cmd_request.kdamond == kdamond)
-		return -EBUSY;
 	/* TODO: support multiple contexts per kdamond */
 	if (kdamond->contexts->nr != 1)
 		return -EINVAL;
@@ -1796,8 +1775,7 @@ static bool damon_sysfs_kdamonds_busy(struct damon_sysfs_kdamond **kdamonds,
 	int i;
 
 	for (i = 0; i < nr_kdamonds; i++) {
-		if (damon_sysfs_kdamond_running(kdamonds[i]) ||
-		    damon_sysfs_cmd_request.kdamond == kdamonds[i])
+		if (damon_sysfs_kdamond_running(kdamonds[i]))
 			return true;
 	}
 
-- 
2.39.5


  parent reply	other threads:[~2025-03-06 17:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 17:58 [PATCH 00/13] mm/damon/sysfs: commit parameters online via damon_call() SeongJae Park
2025-03-06 17:58 ` [PATCH 01/13] mm/damon/sysfs: validate user inputs from damon_sysfs_commit_input() SeongJae Park
2025-03-06 17:58 ` [PATCH 02/13] mm/damon/core: invoke kdamond_call() after merging is done if possible SeongJae Park
2025-03-06 17:58 ` [PATCH 03/13] mm/damon/core: make damon_set_attrs() be safe to be called from damon_call() SeongJae Park
2025-03-06 17:58 ` [PATCH 04/13] mm/damon/sysfs: handle commit command using damon_call() SeongJae Park
2025-03-06 17:59 ` [PATCH 05/13] mm/damon/sysfs: remove damon_sysfs_cmd_request code from damon_sysfs_handle_cmd() SeongJae Park
2025-03-06 17:59 ` [PATCH 06/13] mm/damon/sysfs: remove damon_sysfs_cmd_request_callback() and its callers SeongJae Park
2025-03-06 17:59 ` SeongJae Park [this message]
2025-03-06 17:59 ` [PATCH 08/13] mm/damon/sysfs-schemes: remove obsolete comment for damon_sysfs_schemes_clear_regions() SeongJae Park
2025-03-06 17:59 ` [PATCH 09/13] mm/damon: remove damon_callback->private SeongJae Park
2025-03-06 17:59 ` [PATCH 10/13] mm/damon: remove ->before_start of damon_callback SeongJae Park
2025-03-06 17:59 ` [PATCH 11/13] mm/damon: remove damon_callback->after_sampling SeongJae Park
2025-03-06 17:59 ` [PATCH 12/13] mm/damon: remove damon_callback->before_damos_apply SeongJae Park
2025-03-06 17:59 ` [PATCH 13/13] mm/damon: remove damon_operations->reset_aggregated SeongJae 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=20250306175908.66300-8-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=kernel-team@meta.com \
    --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