From patchwork Fri Dec 13 21:53:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13907894 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 6D724E77180 for ; Fri, 13 Dec 2024 21:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 611976B0092; Fri, 13 Dec 2024 16:53:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 59C766B0093; Fri, 13 Dec 2024 16:53:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F1526B0095; Fri, 13 Dec 2024 16:53:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0555B6B0093 for ; Fri, 13 Dec 2024 16:53:24 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B5D6E1611A5 for ; Fri, 13 Dec 2024 21:53:24 +0000 (UTC) X-FDA: 82891286688.21.4BB3004 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf16.hostedemail.com (Postfix) with ESMTP id 87AB218000D for ; Fri, 13 Dec 2024 21:52:56 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mESrzqYb; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734126778; a=rsa-sha256; cv=none; b=NFRmRXfTxrqJlPKwF/i20W0yPWE3sxWDTZRBZnA80vhkYujUfe0/pIVjK0SgqPco2gP0Zb mzUHYPY12OUGLAZN0Q7Z9WmWDFK8uyc3/lBq3d1+6YTQLZwZ+WNmwaHG3IA4mAloKD+5Ob CQzGa4K+2ZCOtecIeRxzBXdsp1mnL4Q= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mESrzqYb; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734126778; 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=TEw702N4lIrFiN7jYNobAFTVXTnTw7U6kpLLD1E8PWI=; b=17aJKAJIJyxSRs5fOU/ltcrcEVchtV/9iV3zzBto8xSmTmBLJYZL/mmpyMxK1nF443F3VL hWFRakVMR+7gtjaAr+Rcopiusz8JBlXGOCrmWUKX57hqUr1mFGxMXFxt/f8w5ja014mkl2 LUYO6HWP5p55ypWBKY/0TGrnso/HoJY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 101815C6972 for ; Fri, 13 Dec 2024 21:52:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E025BC4CED4; Fri, 13 Dec 2024 21:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734126802; bh=FCh8a972zYqAWkurp7V4i9/Q5lpzQYSovyP9XVSlO7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mESrzqYbfUdBHy6ECESgpIB7ns1eso/niqE8lgDzC14iji3R2caZzJIdB121YcKSA 8usUtKuIPKkO/x3wdfnm3dAQkxrswObf5qC8QijOuBtxK/T3uxAAQQ/8qreOYKuh6Z 1NvECbd4WtD5wK8m4kksLRl8GuDTjNzZhMp/TYB2CNMq60Wi7Fg2oAWh18BO6pNiDO IV2UBs9Koal3A7QNNrWVbA3XdCYhxss0yiG5F0OyP8krUg1xLYWB7M92oTuKlJLrkM rer32ycbaMVQDw4eoOUAVBerPN2QKp5fCqaghHGGtPKKgFHAN89WUp2h7CICRGBCUC nCWH2nqhD4d5A== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 5/9] mm/damon/sysfs: use damon_call() for commit_schemes_quota_goals Date: Fri, 13 Dec 2024 13:53:02 -0800 Message-Id: <20241213215306.54778-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241213215306.54778-1-sj@kernel.org> References: <20241213215306.54778-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 65whpznrctppbgije8s6fdh9k1bhjyxn X-Rspam-User: X-Rspamd-Queue-Id: 87AB218000D X-Rspamd-Server: rspam08 X-HE-Tag: 1734126776-73596 X-HE-Meta: U2FsdGVkX18a0Y60aFP4vZyBcuX+sRZ7wcIC27C0SwEcrZG8mi5Z+EzNHTuNOe26IRRD25aADevK42Zv828d2BpRZ2LjUJEvqSq1N97dMI49nZr9eU5QCDhIO/7G8v1wJ37n5pGOTPHdgOWcq7vDpo12IY1L8mKn6MGcLKU9gykNuOAlW31+PmBwE3SR4AAdBZEyexi5h+KNCQGBTxYQAVUvz74JXG5c6FJ2grH6bdoK1ugotFkwxRvitbZlNQsH5VAUqCQTjJ1JVaV7l0vcxzZFNgze8twqty3ZgDZHxHpkjynzjBJLSjqevFeBm6nfFTHqvxAPoPCazcR1CMG37pZXs84XwqVHMDBFYlk0DPdROUR3K2Ks0bJtAkTk91g5JKbHjVdTxzCkjwpG33K0lG/fwHfKtEaps+9OZ0UedLWkcT4djexGOwzEVOAH1Mnf4jvu2574jP6cO0x54oxu5G5AMQfVBPy4LPmF9tkz8LSAqu/BsK8FhyCCdHMsNESpl5CjGDDOjH3zqzRLPvKLxCCGnQJIFO39Zodbeba4oytJCiGC2TLF1dSnn4Eq3s9EJf2MQYFE8NXksOZHepPnvOHrhnh4RpRx+vJsOzUYywk2rn6MLK1MYJqQ0uz60sYXAh7uzvNkPk6PXCkf/Zn8Y2W8KGyK/cVeT/g5+UzJhfLqA9DMTlwiT9XZMBP06CP+waI4ckP5IrCRP7tqrX8S5XLz3uEWKOQwcDsc0uqo1cHkoyjtM6/mR/zfmJDCfO2vold5T1Jr1XR2YS3KCzryH3aBq2Hgr8NdXYNFTYT4byvjiU5+X3NTjpGZgKmvGVPl3z+ovUU+mG/ilDuHWZ2UzfzL8TUgH7w/SGo+MFkw3LgSceD2pKcRSyVDS6B2OXh4BFJKvwf5mKJs0yNUzJWrfbb9ZE6qmeXpnURz1Xc5/SMNH354i2ebJIkkH4Zms5Ko8KZp5+qvzEY66Oqi6CS 5mNp1+Qu HozwfoIn0jXkidtTfJAQ363fx4wweuYS3ZahNRSr+4t84g9Uvy1ydtTW0FyoRr18QYPnrRW6YvjECQV9RWOVfZJo3O4A1U7XN1NfsACJhAl919aeBIn6WKvJRmHcKnYMFObvp5mrSyRzIsyjVniG29rpt1USjrE/AflO1k/L1xg+EO+n9LNozHgsCo85GPnIJBRIGmlW6eR3muZBv90d/a0iahLci+M5aFPexUJroFc2l78iaet0IU/dzz+tb1v/9YHl4ZdR5Ovj9IeRoLvleXQEqGsDVJsG+MbXXQP0ob2lmFiweGqcplM106uTZII6dICZyhF+RtVCLMwnS078+R3BkC9r1zy2xYkjB 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: DAMON sysfs interface uses damon_callback with its own synchronization facility to handle commit_schemes_quota_goals command. But damon_call() can support the use case without the additional synchronizations. Convert the code to use damon_call() instead. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index d30d659c794e..24070f36fa7c 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1307,9 +1307,9 @@ static int damon_sysfs_commit_input(struct damon_sysfs_kdamond *kdamond) return err; } -static int damon_sysfs_commit_schemes_quota_goals( - struct damon_sysfs_kdamond *sysfs_kdamond) +static int damon_sysfs_commit_schemes_quota_goals(void *data) { + struct damon_sysfs_kdamond *sysfs_kdamond = data; struct damon_ctx *ctx; struct damon_sysfs_context *sysfs_ctx; @@ -1376,9 +1376,6 @@ static int damon_sysfs_cmd_request_callback(struct damon_ctx *c, bool active, goto out; err = damon_sysfs_commit_input(kdamond); break; - case DAMON_SYSFS_CMD_COMMIT_SCHEMES_QUOTA_GOALS: - err = damon_sysfs_commit_schemes_quota_goals(kdamond); - break; case DAMON_SYSFS_CMD_UPDATE_SCHEMES_TRIED_BYTES: total_bytes_only = true; fallthrough; @@ -1543,6 +1540,10 @@ static int damon_sysfs_handle_cmd(enum damon_sysfs_cmd cmd, return damon_sysfs_turn_damon_on(kdamond); case DAMON_SYSFS_CMD_OFF: return damon_sysfs_turn_damon_off(kdamond); + case DAMON_SYSFS_CMD_COMMIT_SCHEMES_QUOTA_GOALS: + return damon_sysfs_damon_call( + damon_sysfs_commit_schemes_quota_goals, + kdamond); case DAMON_SYSFS_CMD_UPDATE_SCHEMES_STATS: return damon_sysfs_damon_call( damon_sysfs_upd_schemes_stats, kdamond);