From patchwork Thu Dec 19 04:03:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13914450 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 92AAEE77184 for ; Thu, 19 Dec 2024 04:04:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B2766B0099; Wed, 18 Dec 2024 23:03:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C4E96B009A; Wed, 18 Dec 2024 23:03:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8A956B009B; Wed, 18 Dec 2024 23:03:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C70576B0099 for ; Wed, 18 Dec 2024 23:03:51 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7AF7BC13C6 for ; Thu, 19 Dec 2024 04:03:51 +0000 (UTC) X-FDA: 82910363760.06.D50100F Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf01.hostedemail.com (Postfix) with ESMTP id 28C7340016 for ; Thu, 19 Dec 2024 04:03:25 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AKbtPxMH; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734581014; a=rsa-sha256; cv=none; b=ENRtTi7oP4A8N2MkvT0OS8sX6oskoj8BCHpzrmLPx1E5lERQ6v+aTbePe1INIepmIBSWXt 96Oajnu9aJHhi5CiU15ThVNmHRe6sSktG53sBV5cvlsLcKoItT5DEvRhREQMNK1ugrxFaf TGo3AbfS0okRmcJb45k8bTiCK418zqM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AKbtPxMH; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf01.hostedemail.com: domain of sj@kernel.org designates 147.75.193.91 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=1734581014; 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=nxDTXNV7CW7MHLxwwQIIuI/2aGZX/T56FQAdJNTiwLCt2kTOZPTKY/pS7qqbqDBN59JdoG IRmWboq56SBh/p9PCQPRUvm7Hxmg6wQi27P6GvGv1DPFC+utTnRAkBlSZGmmbUvmAsMfTH 4j8vJstgIeyFwBfYEMr6S0sPEV8cmxA= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id D66E5A41BFF; Thu, 19 Dec 2024 04:01:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD8FC4CEDF; Thu, 19 Dec 2024 04:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734581029; bh=ftF2xdlxRC1hxynZygPWzsGSDwQOUYQsL2NA51xCWlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKbtPxMHjXd7OQ5NwLrw2rb6mfgfVvKC+Xdq9KN6MwWXV9XNXYG4JzMifPgH+ga/s Vwr8ZzhYg18JFB/OYTJP+eOGnvUF9fSjiXvYRxbBsRiC1QEUjiREfqmzGlKo2lk87l qEcOWHjI00o3g80l/lUYFmovE1es9Vt9QIcwW452AR+Wmy52mDaiEGrHflcwcVmHJ6 gF5ob4nECqNkAzPa7j3GmYiVmyb+nb7R1xmJ9IPL3dpdzWyPqJhGrkXPIzmK7JtiDg cKuHyBjb+4x3visLeMmz7Sv6wUhjFtO0Bv/IXPOA5CSk+G6lNHGNanfA1idK/atgZc nrrnve8rqAACg== 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 09/18] mm/damon/syfs-schemes: implement per-scheme filter-passed bytes stat Date: Wed, 18 Dec 2024 20:03:18 -0800 Message-Id: <20241219040327.61902-10-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 28C7340016 X-Stat-Signature: jrfxewc5uzgwfmhuj4kwqbwi5q7gc8sr X-HE-Tag: 1734581005-53992 X-HE-Meta: U2FsdGVkX1//Y/9LB5giWlJ6RwoL3zfrhAep6Fw/tPQeaOmbUklpOHbhNNB6Nd2TfcDxT9RyotthLoL9iP4+ttxTS7gNV+lNBYpIa1lO5nLo5bAAkvX5qfDtSZCEHxUU1CCvUCC1OxM27jiFTp7zGwronBS/MntElk/izU1qnLOqwMbkGnNjWPVDN2qSiMjt2zXGCCYk8ol6+eAbSSjUJ4kQy0DH24AU/jvVsqvIkbeX50tkOtZVWQkj8btspvxB3q9H2GQODQ8hryGjwQuHOmZyB2uv6wUUZp2wy+cehtQFQZ8ydgvOTSIGUgJZvWq+9elVA6VQHV2PXA7DNWqXT6/eWI8Wq38w24gJybQcUq2vaFqzs0dNqwvdsbwS8lqDtci/2rOt6EnLOlwZn2P9M1UsaEP9bnkr3tvF6b7p2Mn5dq7GB6kEpwBmskkxdADELfcyerxxwFRiu/dvkG497C5lbWd8MFrcUIjzWxo8tjZsJnhtnSlHHS1K51fMhF4zDf/NHiL6cc9MRmISEDFljOzaGsJZpaC2ZqZ+h1BQHt3WWuMMXEV3AFo2F8FFj8pxd24KQrlFIczRHZ/Te+Kt0rZJuR1/26EKKz5QPke+haGYMH4nUBsrypVnxQekGHDFf7TQZsc34tk73IOht0lZWqpviiq3ulxbAuFzY0y4p1hGrk/hvoyV1Nic3l36jr14OY7CMTBn4mXIKs+9lMfMSAKS5GHbEwWbnc2uKpRn7ekrCGcyNpqSQER5QQkCJyLN7xyc8kEXaNjUnn2lf4o3VmTKvNjeJt6dKfyUM7k5DSOP491W2rGr7nKiqq0GTjnSJdo/9pdC9OUVayHV0vbOTwgPlenso5ObYvVYx2A9FLcnpVwAvcz+xS9ArueyBFAusyDUBlAHkxdwvQMfVGwLfbJ6q4im1H0N2mOy1sqawpaoHfBeg6JFyoxdApvLeKGfpOiXl7m4tA4Z/GcuW6p 6ZLXq7Iq BsdszGbh8PgPIRm0d5tQ682eTrHdzj/TCElACuHsfhgXpfCo5eIg8LStYQy91Ciw3sU1fhkfBEkQpRKpjdCg44wc67N32/T0MyTawQXijvDY7lVrxzfFMPmEZAd30TdY+OLXH9nX4HHNfdhZ8Ab5IDBmWsS0EIiLf4tBxk3pDWK1iqirLXX3LNqX094e1l9Jb2G9oBhr5BKkvVhehiBsZnHOdUCM5br+i5iPxISjw9+5o3e0= 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; } }