From patchwork Thu Dec 19 04:03:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13914455 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 EDB11E77184 for ; Thu, 19 Dec 2024 04:04:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CB2106B00A0; Wed, 18 Dec 2024 23:03:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C5BA76B00A2; Wed, 18 Dec 2024 23:03:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B23EB6B00A3; Wed, 18 Dec 2024 23:03:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8CB706B00A0 for ; Wed, 18 Dec 2024 23:03:57 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 448811C7E33 for ; Thu, 19 Dec 2024 04:03:57 +0000 (UTC) X-FDA: 82910363802.08.537A353 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf08.hostedemail.com (Postfix) with ESMTP id 108E5160008 for ; Thu, 19 Dec 2024 04:03:33 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rzq44vv7; spf=pass (imf08.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=1734581011; 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=vpg2w9OBJGFBhgZAOMPYZK3k1PQHa+4tX6YfWAsBwv0=; b=UShin/NWTFCPJdexZzRaYNJEcuwiVaa/ljI8aL6YdlU2+c3TJHZa4VdFQMBqxC7bzrCvxU GI2WKYuOjwM4xqLqMXvpzlRq++IUrDj9cc7CdznCqxXBcbuusBM8fam1EtR/P0MaqqdI7R 10743d7q3P/XffNUVtRNeNqGMvaKlBU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rzq44vv7; spf=pass (imf08.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=1734581011; a=rsa-sha256; cv=none; b=vR8zdRsekMgYF4/t1foWu0KG2lTHPqMekEv8zolXPjH8h0uvNsMK/eTOkWNMlh5i62cMnv CtoTReQnLehIkRAlTeTviB/W+eB/JlL7uRnHtaga7w25WYOOuCvWLndKOTFimZD3lO2cle gZYue3I7kMxZYfT6/avV2c1AhkSbA4c= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 9AB3BA41BE5; Thu, 19 Dec 2024 04:02:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8A2C4CEDE; Thu, 19 Dec 2024 04:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734581034; bh=B/+pkZ34Zt3Ov15iD+IrfcocGY4pQLzf/O+oQbY1lSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzq44vv7oD0N2wj95XS2ZTJ1sSLOaqBIUq36nn7pmxoSw5ZpgQ3g9DCAnXg0Anw8n bFIpSdP7Yv1yOzha/Bw5/GTL0aH+9FuEQETPdZSKYcXkSx1h6kbPkkW7alb6gbJfSh lfXrUimMecgBRoGXL66pD0XsJ7rhIasRwOt9nREX/c1KWizBC/YE4+yeambCjMRrqi 2ekvViNaTS5YuWgpQDNpxWjG0XZ0LiiNSELDOa1vjr5LiscPbC4DliiXVSmov/pX6q ou0yrGFJ+KLQ9Z9woz12s9t7dC0cCGxb2Pzh0a2YEXdJgzisKDiD2fEyjo0tM1gGOB jnrg4qfav135w== From: SeongJae Park To: Cc: kernel-team@meta.com, SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 14/18] mm/damon/core: pass per-region filter-passed bytes to damos_walk_control->walk_fn() Date: Wed, 18 Dec 2024 20:03:23 -0800 Message-Id: <20241219040327.61902-15-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241219040327.61902-1-sj@kernel.org> References: <20241219040327.61902-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 108E5160008 X-Rspamd-Server: rspam12 X-Stat-Signature: gihr4gco4niq9moup84riic5ygfcpdhb X-Rspam-User: X-HE-Tag: 1734581013-521818 X-HE-Meta: U2FsdGVkX1+xNO1XG63Uqn228Y7MwV1B1i3WXvilp+/v8QJn6rAb9vdEpFzm54LbAV1EIpgiZ+ftAo9Mao3jqqNoKWIrnjeMNAZoZKdJdEPShJcIHoI0RaazMZ8Q1aFGkc2Tn9D8fkqHJ65C990GKv2rpncxuyAl31v3qse0c+snHUAwm0Vh/deBm3Yt1cPR85ajJUjE187n+yGxakRmmeUKLtYiG7CHFaKKoHsFJBRUMo2guHJZiMvL+g3H7RqiR7HD3h/ZjpRfwOk74kg3J+RU6BANz35txsUbfqASvK/X4U1GshyEU7r7T7ej58TCpkkWE0HrV3dUTiBMwVvOGazRG8AUp7lO1F0MBwT2YZbPrXW34bBDl2JMkO4+Y5eQaHnsLGQernkGJaJdiZzMmRdjYwQICZhdYVeKTIOxP+joVAQvSz1Dt7lovxWQ3fsKsgf5kocoGycBxdAl7liLrzzqqfwkp6uInAXzCAIdr05OJitOrB9fnzkWK5nWxt2jtyhGgBDpaTjQUXDfYgLYbQIERhiObKYqLinNCKCoxIUI4wiVr7waYSCCSxLT/CH7O4+Rj8ICDuHQbpo+v4RHKFCgNy2JM3TNdMpLb03D/jVcIcJr+cYxIG3swhMFQXzM9lJBbJH1yI1YukrlaOzGrogmcbVdzfQHE48gfWw6LLMzPXj7e619PLbNPdfpIZz4xr/G2cfb2ajpGY8qqb7LRbQ5llDdUCnjKAJF11BlS15xueAbDDnpXVyUjLi8Qy4mhgjtVrGbod68GyybD/MWuOr8hYFpOLBAk4XS8KFIg1YR/yqI2mQYKhAebkSY/ZOtT8v/c520LwyngT88fwyN+ZZXr3GrOHJM9eUqiN3m1LHYNl7y+3u1bBJiiASrznImOasZD516IXekRG9qdiNzCshRVpZKsHKCSAie7YYMdlBX8FTjS3AjmeL8hs6k6xAJ3nC/+47y/sC3W3djpta FjMJzIi9 WNIXsjWv2f41KFNog569h1TjlUyU39rKlBHo9ElW6DBNPlQEqiq6C4idooPSJsQS/Cfrb241EFOpmBsXYqYXHwRk9I1gTFiKp/3MlJ1jpNtZ84hvwNDXa3HdLP3sRDkiRlrfi8r5JDaG8GpruH5SdKnMXB7zCMeCeq6iD0BP1y0d/SYv3upItBYkmXJnne4ddlRpAWXwd4bibYAVOxagob6XOi7rUxShrZ3OxTNXP7aKjK/Gy1Kgu5oMnJaV49YIUXtKWgJcFCyLZuhYqt1YCPPsGIw== 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. It is useful, but that for each region can be more fine-grained information. Provide it to users of DAMON core API, specifically damos_walk() 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 4a68bb38aad5..b88f710297a9 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -393,7 +393,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 f7736df4f6c8..f566cdcbb434 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1437,7 +1437,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; @@ -1446,7 +1447,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); } /* @@ -1566,7 +1567,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;