From patchwork Mon Jan 6 19:33:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13927789 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 ECE1FE77199 for ; Mon, 6 Jan 2025 19:34:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A61966B00A6; Mon, 6 Jan 2025 14:34:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A10676B00A7; Mon, 6 Jan 2025 14:34:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B13A6B00A8; Mon, 6 Jan 2025 14:34:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6A9536B00A6 for ; Mon, 6 Jan 2025 14:34:19 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 26C72A0229 for ; Mon, 6 Jan 2025 19:34:19 +0000 (UTC) X-FDA: 82978028238.15.7DB6151 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 8B03A4000B for ; Mon, 6 Jan 2025 19:34:17 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaxbcO1N; spf=pass (imf27.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=1736192057; 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=wKALUXA5KOlaxQuesRY7XJJ0y9IguV010vsxGpJLWbY=; b=efs1Z4R4h97dchrSb4uYNSKab69g/J4uoDe8mQ256/23TYNA0/QAmOzS1hNqbOBUDJZpX9 KEUmLvzdo5DOeCEGYCpzEpIbzQit4MJsLTJA1fgAMKxUsqp90bJLNEmRPks4G4NOy7yXRA 0FrQX7PPPl9zT64EO7gOkhA8Xxqc58g= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AaxbcO1N; spf=pass (imf27.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=1736192057; a=rsa-sha256; cv=none; b=PSsw3TN6UwOVIfEAvEfUppYD3MIAkhsKkm9N7Drxor2hm9UG0+eNmSxSTP/2oJt1xYmZJ4 rbeZyAR0R+j9zJBbQlvwaGE+XbL4/IENntcvIFD/J+j2+ovPxViCHT8yNdLi9I7l5cqPpG tTM6sIWicUZnchTizzkvFoWKerD+pgs= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B13B35C503A; Mon, 6 Jan 2025 19:33:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E02DC4CED2; Mon, 6 Jan 2025 19:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736192056; bh=ftF2xdlxRC1hxynZygPWzsGSDwQOUYQsL2NA51xCWlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaxbcO1N74CCY8kGmY2WADbvphzHKKpytGuMvPR+8lLiwQOlrunTi2X5WMv8mkVzG MLg4dKAmhV42dJUeoYrmpyEEFHWwH4mF2COFSKwS+2FCZTgnDRIgqNipLyjJSyILbP CP6qSW5byI7JNIOoaTR3LSLiNLPhjLq2ky0gOcp7FimS5C4ttM/18Piv75DbSK44U9 4UqSZPGvVZV5I5rTJE4KWmziN/MC3hgZV1MwI6NTDDdJo4C/BBCNCD0ZKGFQaTV2VL y64Bw8WUbCxqcI2O94lTR0AUQ/Kf6C5bLiyD+T1mWvpdcpgZmnQocTuL7F5MQzw6gp oVSWWuDz05Xwg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/16] mm/damon/syfs-schemes: implement per-scheme filter-passed bytes stat Date: Mon, 6 Jan 2025 11:33:53 -0800 Message-Id: <20250106193401.109161-9-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-Server: rspam05 X-Stat-Signature: 8ap7hkwwjns11booopfd4mjtyg77ghsy X-Rspamd-Queue-Id: 8B03A4000B X-Rspam-User: X-HE-Tag: 1736192057-490855 X-HE-Meta: U2FsdGVkX19Lg9mFiNLNdWWhXSImREfS7V6fXttkE9EUv7lun4xK82mV3/y2Zt1JmX6pBJAyOX8ZS2adxheEW1Xh+j1mRVeRVM0IMwkqzWJ7+6kvsC1yFmcuixLy7yrIox9IpbchbcgKI+JrVbH1djmhY4jQVPu6fTqnikzOtp33vv0AckRXGWkoxTmBRwdZBUUs3sT7zD+z8WXPmV/G6l4tASHp8z2+Kngw9tGTfzZ4DPMcouFeBZYX4mXvwX1HcTBbq5N1ZaQK9uozJOupREkMXvzrScmRqlSOu2lxIID3jBY0jJDj5tlfQozL1Eirp3IrzdMtiMQ2e/ZSuZ6b9xFUahItTjk4iKE6QYiipp05/W6Xx26EE2tMcDzIP2pDX1R361G8ntPASO36OLfmthcUKd9vFUiSxa/h8/1T1EOlesBXPGo0HGFp/p4UBeuDWYTdcs9sh8zDAVzN9jO5gkuCsCel1OC6vkqwGPcxm+hRZJHxaRAJ20EUYy95DFU1tcdSxazTnrdK94eOm3A0oxOYvtlXcHBeV6FUTr8WmPJyi6e88I95JriPQ32QMi/VN+cXzmgADYpcnQVtS/qTGPd5sKy4jWhA0+yAaFRpou5TDF9od2O+cM9cVn6gNEna+zXoxDrE/z37rdyi/Wm7G7sKpngPteN0OXNASFYTR1KE52nBM8iFyomsCCuU3qPKxGuNsi8CrSAezoZMIVUiefCANHDUz18cX+DcxI7tkwLoQZcy0P3CcdMMOTdVRJM8HsOXb1udS6U9lAFabW7h4hfg2RDrG/sYLOm13U4vXNesaXH382np2Ydb2RjtYjXdisdnmFwGvkKa5FHRKvIyu51+rWLOjtgCMjSKE9hH+iNlEhp4vvAMj7qw4veR3gQ5EPL1jQvDrKWWyhU6JpiyyEKQDGIqtN7iVGg0pjamkdngoVmox4p1AgwzixhWWJSw6rwdFDcupKBxPM67cgi w2q2zCYu Pp0Ymtvk0JX8IIRd0ofuAUTJz15Ialibe8IaRPfvKlNrZ8Q+MrWrqQXcb/sWfWf+Fn6swHe1Nly5ILtPCeQYLPNLzG/q3pG+xL4lfAyu9uR6tA1wNU40YsOONMghahSOwvbuyiEd21Tm/h5MCg90eyN6YVWTH1K+9jEj+z5vxc0IBheXE0UB+AnwgULJEdGRvPTW/d6Yja8lkzJfJW7Ik42cHGCX+0XRsTc4UsTrsQceRGyk= 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: Add a new DAMON sysfs interface file under scheme stat directory, namely 'sz_ops_filter_passed'. It represents total bytes that passed region-internal DAMOS filters of the scheme that handled by the DAMON operations set layer. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 5c4490b97258..b447c412b02c 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -188,6 +188,7 @@ struct damon_sysfs_stats { unsigned long sz_tried; unsigned long nr_applied; unsigned long sz_applied; + unsigned long sz_ops_filter_passed; unsigned long qt_exceeds; }; @@ -232,6 +233,15 @@ static ssize_t sz_applied_show(struct kobject *kobj, return sysfs_emit(buf, "%lu\n", stats->sz_applied); } +static ssize_t sz_ops_filter_passed_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damon_sysfs_stats *stats = container_of(kobj, + struct damon_sysfs_stats, kobj); + + return sysfs_emit(buf, "%lu\n", stats->sz_ops_filter_passed); +} + static ssize_t qt_exceeds_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -258,6 +268,9 @@ static struct kobj_attribute damon_sysfs_stats_nr_applied_attr = static struct kobj_attribute damon_sysfs_stats_sz_applied_attr = __ATTR_RO_MODE(sz_applied, 0400); +static struct kobj_attribute damon_sysfs_stats_sz_ops_filter_passed_attr = + __ATTR_RO_MODE(sz_ops_filter_passed, 0400); + static struct kobj_attribute damon_sysfs_stats_qt_exceeds_attr = __ATTR_RO_MODE(qt_exceeds, 0400); @@ -266,6 +279,7 @@ static struct attribute *damon_sysfs_stats_attrs[] = { &damon_sysfs_stats_sz_tried_attr.attr, &damon_sysfs_stats_nr_applied_attr.attr, &damon_sysfs_stats_sz_applied_attr.attr, + &damon_sysfs_stats_sz_ops_filter_passed_attr.attr, &damon_sysfs_stats_qt_exceeds_attr.attr, NULL, }; @@ -2077,6 +2091,8 @@ void damon_sysfs_schemes_update_stats( sysfs_stats->sz_tried = scheme->stat.sz_tried; sysfs_stats->nr_applied = scheme->stat.nr_applied; sysfs_stats->sz_applied = scheme->stat.sz_applied; + sysfs_stats->sz_ops_filter_passed = + scheme->stat.sz_ops_filter_passed; sysfs_stats->qt_exceeds = scheme->stat.qt_exceeds; } }