From patchwork Fri Jan 3 17:43:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13925763 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 6546AE77188 for ; Fri, 3 Jan 2025 17:44:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 850BF6B0099; Fri, 3 Jan 2025 12:44:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8037D6B0098; Fri, 3 Jan 2025 12:44:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69F796B0099; Fri, 3 Jan 2025 12:44:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 480DE6B0096 for ; Fri, 3 Jan 2025 12:44:19 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EDFD9120970 for ; Fri, 3 Jan 2025 17:44:18 +0000 (UTC) X-FDA: 82966862958.30.EEC9963 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf19.hostedemail.com (Postfix) with ESMTP id B6AF71A0019 for ; Fri, 3 Jan 2025 17:43:23 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="JgU/JbFv"; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1735926233; 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=ezK6oTp14HCpwDhd8lhtdtnxV8X5s31lGnDCurJhbRE=; b=39txvzoemde/G1r5MdXUqvc5mQCHg3HuEHA08bD3naLSIwZWIBF9OOXF2It74Rj3lQv9Hk s3A0bno+tKMtdm6hQ1m3tlkQb5Kt9eVAX2LCy/R+HCz7jMBSntQlWegrWZLehfNRraFEwY dKoqvoiSDQnjSnU2qziQtTqbNv90vs0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="JgU/JbFv"; spf=pass (imf19.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1735926233; a=rsa-sha256; cv=none; b=vLO6cpeUmuuyDGPKQqyL5iIqQxynsDnkAY9lOoX5GRBvlnqdFdjsJ3q1EgOwz2AvdLjS4O e0NziW556Ny1U0dSUC4KQeqEXo3mc+F44Icjj93y8spfCljyXFAwxy8NuKI15J557zB0++ 87pRxg2C3C6EvCs9ypfFQgg1lA6WW24= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B69BAA41042; Fri, 3 Jan 2025 17:42:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43D48C4CECE; Fri, 3 Jan 2025 17:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735926256; bh=Qli68w9RR6OLGHO/urSk5Kw3GxzgWY+dpbdZAM29uik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JgU/JbFvqWQxRNZrwv2u3F+e81eK1EgkWJYkhOHqGLuj7+9iCsEdy8uz0/EUuv2no IDaP5sZ58eVF5W03tH3XdL0IA/sDRyGBeBeTprwsygO7K9AYfQdv3zJs8jfwS6yCzz Az07ONWHLy4u2Fl3svvpsN7qVGh3Nbb9GkmrSrCrNrByHVxlE6iRNLxFFVAvRQdJec ICTLWpnV+Fgj3ajHByMevRJKnExULKU1MfF/d3EgBupzZqtPZsxNNttxMTDzE0Ujik U5LUpgi07rIR8HyHfkT2HTBaLms/BaZDA6QIGEJFx3S2zIOYfqG9WvxbfjtSzMJZmJ qldWRQ/c7hwEQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/10] mm/damon/sysfs: use damon_call() for commit_schemes_quota_goals Date: Fri, 3 Jan 2025 09:43:55 -0800 Message-Id: <20250103174400.54890-6-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250103174400.54890-1-sj@kernel.org> References: <20250103174400.54890-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: B6AF71A0019 X-Stat-Signature: cm8yxgtmp79upe1wrhj1t9ihycdwg3ez X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1735926203-987460 X-HE-Meta: U2FsdGVkX19aaoKKL3Nty7szAToso3P8v+BxNVqd79cltFACpkOsRv3U6UGO4EPBW2bGvsriwYVtg0ifyDhIyW590bad3eUHCqHtcQqq4PfDTz4JR3Ib81WMWq5zsGfEoXdr8kanNf+SEYyueR8ongOSyabvHpkaYoKUGxL7EQJWypOT5Xf+MbkXGF/h4Hcdl0cTNV6NA6ywNUgFRNE7Q1d36xsvpn1MqSkA5MdymH6SP2IN1WRfVaGTdx/QTlv2DfukSJ4DGXdzY8nY4ZDn3l7sI/TLq0GEAHq33Kdwli1nF9DtCcHuPFlIydIvb1gMtXa0vCdxTBDTm/RcT5uFSnDF3IskbFuZEyB/bIspGAEZeh7+pnbLuG5KPfmr1avBKBO2Rnppu5CM1OQLx5aAMwzelDmxUVLpQa9ZMLi8Amj7OPTBxZ+xu77ohD6mgaRSAq9AG4nFWSCtogY9ibya+WTVS8HvN2G6hPRQmn9BDgnlnom7HLKO5s28+xwnN1G1vaGQt6emfd/U1Efkm/BvR2Tulv0XGob/FJAjanWQ3DyaVZ0iHi9OU1/+IJbxjtxZCdmpPq5LIeDuSzjqyslSmY81ca056GTQc+lEhyKZd5yGZHon+3ZC0eVqQgESdxmZPXyO/hKjHrBsXZDDDgdrY5Rc78AoGBCDzg2k0Is/KzYbGruQcPnGImXOdL9Z4hBmGkkcnoZC/yNFybtTLF/3uuHOXbmwL/Ob21tmHxYFXl2w+rd6ClZxfdUz6kRVOY6OAcDlzCyLCDB6rC/4gJNDtE2HcZHbhtQSceg8EBIIFqOhOPHUTBhAfdhtpXQfE1gmvQ+Da/S7spGYrx5CuUENkcGnWR06cwB0zYoUcwUlcwDoRb4uZV2EION2EBMw/rit2ZA5teMEOVZ2xNnAkUXgyXRob9jVKqUtSx57+pLNJUK9Sg9JgSCK9Yxp8GTR9F48lgo6AdpPyv33nukL1kU 9pY/UqGu Vo1PaJ9mDlotB0LkbvM6I+NUCkgc8AfbBpq+NRTchZRrzJEO7DpY34NCpR7Yvt8H1/IUP0fKCIRUlnRS7k4E8H6dwiHfQjwtrSC3bhQyd4OrOqB9Vr634KsjCrfFB57s8qcXGWkkDuzThF/WG0Jw/YUWadnhnmhB4wPPGm0Cf2qj3cW0+g++5E6Zm0wwaJ+H6LGTdM032DFusWCpGzenCvJE1G+vcPis2n17+eCshohy0ZXWLrE4fv5c6u6cTnYtABR5Nbrx5PZwZDvOqrpOR0nVS6Q== 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 708c2ffdd620..7c2aa9830edc 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);