From patchwork Mon Jan 6 19:33:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927793 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 5377EE77199 for ; Mon, 6 Jan 2025 19:34:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CAB386B009B; Mon, 6 Jan 2025 14:34:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C33446B00AC; Mon, 6 Jan 2025 14:34:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AFA576B00AD; Mon, 6 Jan 2025 14:34:26 -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 8BEB06B009B for ; Mon, 6 Jan 2025 14:34:26 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4EAE61A02BB for ; Mon, 6 Jan 2025 19:34:26 +0000 (UTC) X-FDA: 82978028532.10.0D0E6A0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id AF264C0010 for ; Mon, 6 Jan 2025 19:34:24 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="kmGp/YSK"; spf=pass (imf22.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=1736192064; 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=yXzMwO9hS5y61HDGqQ7DE3u52lWTcfpiQpo4Gtz53v4=; b=1E9THDYH8vVmclqnIi7pTLiTV/Rvc9JbeE4+olMwr7+syQWyEPsaFDV5AuyyRrSDmjIvmY fnChh/jgY3kQ5wJ2Mm7nxZaybzCKeOsWxkGFEUNerN+Bib2oam27M0/oGY/rHmnLCeNPdF 5a0DLwuFXILEWosGekuw0VWMQ8HCboc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="kmGp/YSK"; spf=pass (imf22.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=1736192064; a=rsa-sha256; cv=none; b=tsGJUPyLXq+WGuOPEJ2+M8o1DrR2VnxJgI7b6uItAEMVHQBPvk7i9VUUsKvr/SEZ5p93i4 QPWNvfrjov5b7T2EkACA5w7d8FrHNr4l9gls3LQjljv8sRRCzWCjjGPcaWVmYg+hwdYgCr 6kUy1gpx032Z+e+pqpt+e4aNY7X8X+4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9BE5D5C483F; Mon, 6 Jan 2025 19:33:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44F67C4CEE1; Mon, 6 Jan 2025 19:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192063; bh=9gn2VJXpZEBUyQ5318wgjN/Yy6FG5EGU1q7w81srFoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmGp/YSKlwkmxzXgv/o8J64JhES9W8mZpq1ly1q8cr951yRnCYYBc+G+O9OJo9Ntm ei/6x1XkBqsB7+53WDs/LFeYPYruqAXoFJS4uE0Gh1vNIkawCPg2i3/p5J3QgX5sf5 S4zc+/lU3kLflxuXyEviljbr5aGwT6nwZaGGEQ40outywIoBdGmToxaaIaOEXN0/O9 PVJE2m5KmRSwKw5n/VVqglh1OsVZcpoIv02xKb5etGU2G7ULwSSVDX6l4fQLj2Cnm3 KMHiaNt3n08C3+ZMUULxd1akv1pG4qpHs2SBQFb10qNzaNH/C5EJyFjIR59VMgiBub a/LKIHGFS6zXw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/16] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn() Date: Mon, 6 Jan 2025 11:33:57 -0800 Message-Id: <20250106193401.109161-13-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250106193401.109161-1-sj@kernel.org> References: <20250106193401.109161-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: AF264C0010 X-Stat-Signature: q9j615dzpx4io8s9pdcijrfjhrorkoai X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736192064-142867 X-HE-Meta: U2FsdGVkX19vGzf5QCCuW7iw4EQwH2lhvXJf8hm9nPbgK7jd2pzUthQ6zsHQ52FUfx050ltJlHosL0uOXtue2K1HpEKlUK2Rd+aZrLT5CXBxVkuNzee9gW35oVoRGAAPSUZ137smoIsYoPyhbSAjRWV2tjuKsYe7/IUURkCd/9wBk0sHYjSHpnjw0MqsEAMeSggApJh9Bxx3dXmrBWOiy6iR+y3k/u9T5f4SXzQ3Us1Iw9A2sljPPOQKA2b8WFFBWm9Cepy+JtPbng9ggE47oUzTTzaGToDqdbpqPANm+u8k5CAD+imHrX3S1wOH/QEjy/che+LASbvj9jF+1/0ZP7hCcTZPFOHvVldO76soP5HhJOix3EJXYZpEFCeC8T5BTnRbCkZ10cm36Ss9CisB37yiiqGIpraOQ+ntwGUIDprN37PXA6UhR8JcFquXYNxmyRbr1Ei+JcxvqPy/RV+/W4j1Vmz7WT8Xog3l5W3auXMqmDK9KjG1uLtfj/z2qnoTA//41KnSPvwFxssucj07HiwfCRvGOj7s80FslxOfKM3rJGSiQyqMGkgUgqyaGuyI8WoYfcvxsILs131TDmeinzDag+WEiWBsdTmPlDa6piSwHaHa7GsPujBv8SDJRQ+jmaWpX6IldSpyGSXFHDAMYPX85Td4jNuohlvxZb5x8LVbigSpdcsfF0DcpXzk89AZ4wUmIUVewUa9IX6nEJS88AYGwr3NrZi0Veq2QeqiNYgvyZRgFtIDAyvFvN5bg09E+n8P4515e91SXoViLVR42n1+jn2/fA1iM9qs3V7U0LHfs7yGg1U8/iVigSkIywfEroH4kJYgaU7dPyLc9keqg26iqkSrDQL16xRb1Fb3Tvrs2U56/yjq5sodJvnBd/seV8+lYQR/ItCfdjZsu3QpahhqXsUP7ixRXkgpJ/NESBAbnZyYoqQv2K/kaXhP7KH5DODvPzPQkLlZtYaGhHI pS/d3uAd MXNgbveN9qH8c308Yn5feGqHXH9xzZfJ3+GS2V/HrDsC6Pui35gbD+GIbqHd8G8T8es8vjVEosfMl/vork2oPNoCImEVvE20xfsUXnvE8aV4nIbkNDU0KyJvfvBuRplKySVe//jKbiGC/IJrA86BToUFMEWdDpZ1C2AiJOfc+3cZtTTCC1GKK2T/ItIDJP4OMDbf4lySRRAPRn8zURS0UjTpSiIKrSZ4SFOMo0vTgxxx9u/s/ck5AcGerAmHNHJex0jHucXqt7VUzqovbJARwZD7P6A== 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: Total size of memory that passed DAMON operations set layer-handled DAMOS filters per scheme is provided to DAMON core API and ABI (sysfs interface) users. Having it per-region in non-accumulated way can provide it in finer granularity. Provide it to damos_walk() core API users, by passing the data to damos_walk_control->walk_fn(). Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 +- mm/damon/core.c | 7 ++++--- mm/damon/sysfs.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 2a93dbe06ecc..298b1a831e62 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -388,7 +388,7 @@ struct damos; struct damos_walk_control { void (*walk_fn)(void *data, struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *s); + struct damos *s, unsigned long sz_filter_passed); void *data; /* private: internal use only */ /* informs if the kdamond finished handling of the walk request */ diff --git a/mm/damon/core.c b/mm/damon/core.c index c4ce72a86d81..52e50f183ffe 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1445,7 +1445,8 @@ static bool damos_filter_out(struct damon_ctx *ctx, struct damon_target *t, * installed by damos_walk() and not yet uninstalled, invoke it. */ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t, - struct damon_region *r, struct damos *s) + struct damon_region *r, struct damos *s, + unsigned long sz_filter_passed) { struct damos_walk_control *control; @@ -1454,7 +1455,7 @@ static void damos_walk_call_walk(struct damon_ctx *ctx, struct damon_target *t, mutex_unlock(&ctx->walk_control_lock); if (!control) return; - control->walk_fn(control->data, ctx, t, r, s); + control->walk_fn(control->data, ctx, t, r, s, sz_filter_passed); } /* @@ -1574,7 +1575,7 @@ static void damos_apply_scheme(struct damon_ctx *c, struct damon_target *t, sz_applied = c->ops.apply_scheme(c, t, r, s, &sz_ops_filter_passed); } - damos_walk_call_walk(c, t, r, s); + damos_walk_call_walk(c, t, r, s, sz_ops_filter_passed); ktime_get_coarse_ts64(&end); quota->total_charged_ns += timespec64_to_ns(&end) - timespec64_to_ns(&begin); diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index cf8fb5a963d6..224873ca8aa6 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1454,7 +1454,7 @@ struct damon_sysfs_schemes_walk_data { /* populate the region directory */ static void damon_sysfs_schemes_tried_regions_upd_one(void *data, struct damon_ctx *ctx, struct damon_target *t, struct damon_region *r, - struct damos *s) + struct damos *s, unsigned long sz_filter_passed) { struct damon_sysfs_schemes_walk_data *walk_data = data; struct damon_sysfs_kdamond *sysfs_kdamond = walk_data->sysfs_kdamond;