From patchwork Tue Apr 30 14:00:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13649088 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 341A2C4345F for ; Tue, 30 Apr 2024 14:03:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CC5376B00B5; Tue, 30 Apr 2024 10:03:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C75D26B00B8; Tue, 30 Apr 2024 10:03:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AEEFA6B00B9; Tue, 30 Apr 2024 10:03:08 -0400 (EDT) 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 8DF036B00B5 for ; Tue, 30 Apr 2024 10:03:08 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 00CFCA14D8 for ; Tue, 30 Apr 2024 14:03:07 +0000 (UTC) X-FDA: 82066364856.12.3A99E49 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id F29A540030 for ; Tue, 30 Apr 2024 14:03:05 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MiE2TcE1; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714485786; 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=b5EgDjFNrAAafAzZBTKxBCvxuUsmkAdGKL3AYN1EAj4=; b=NcDuBr06w90rWM9s1I8mNV6/chOVOeLtMcxRcU48wwK+PcNlF3n9P0NAbIAnufRfaJIkxT J/hINijfaAHIuu5W4XtxlZKsjr1fGRXjVPRQp+xNMeiv1TCmOnGc8ubAOQX+vxX25z2Rz6 IREJkMK0uYtkJOJ5TZFb2ppwvTq1Cq8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MiE2TcE1; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714485786; a=rsa-sha256; cv=none; b=WWX20NsFPEXR5rWX7czHpqJCb7qoTmhAF/kyzsH7UnsJ7SNCSba8+pCvsSIKuzLc7/ul// p0/YOvRDEpnf9VNdL9AqYznslOj0ww1EKzM8kM34y96Z8s2bqWgYB9RPGU9dbuhSTyIOJI f17TkxqE1pfiTe585DyEzzgcIN2vHd4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714485785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b5EgDjFNrAAafAzZBTKxBCvxuUsmkAdGKL3AYN1EAj4=; b=MiE2TcE1+I0KkA9TXiLAsP/6IgqrCO026OuUm0Veh3jPThef5tIt1B9ab/fa/qKFMbFW4S kuqLIVwM+TDFHS60jmpvETuXXAZMt7VOT+0fmW8jrpw5fiCXnaGhb8Lg5EJOjI+ZzH4G1L twZgr2YTKOTYHfp/54Sj2MWjv9L56cA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-X6AaRPb4Mp-V7xLKIzX4rA-1; Tue, 30 Apr 2024 10:03:02 -0400 X-MC-Unique: X6AaRPb4Mp-V7xLKIzX4rA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9766F834FFE; Tue, 30 Apr 2024 14:02:08 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A59F2581CA; Tue, 30 Apr 2024 14:02:05 +0000 (UTC) From: David Howells To: Christian Brauner , Jeff Layton , Gao Xiang , Dominique Martinet Cc: David Howells , Matthew Wilcox , Steve French , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Eric Van Hensbergen , Ilya Dryomov , netfs@lists.linux.dev, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 15/22] netfs: Add some write-side stats and clean up some stat names Date: Tue, 30 Apr 2024 15:00:46 +0100 Message-ID: <20240430140056.261997-16-dhowells@redhat.com> In-Reply-To: <20240430140056.261997-1-dhowells@redhat.com> References: <20240430140056.261997-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Rspam-User: X-Rspamd-Queue-Id: F29A540030 X-Rspamd-Server: rspam06 X-Stat-Signature: 1do9wi4qtjb95ajnthojhuyssrsrozpw X-HE-Tag: 1714485785-626163 X-HE-Meta: U2FsdGVkX1+CxzuLe7uDqPTOhAjuPPyjZdULHsvfwWOKKccd544QMkNxu2DkPaWOG3OwM+0kfLlNJodTu2WwfOWpFSdNBpi7NBB/0ZAwRGehGTy0baAwKHVlMz3uBPHW4p/h8PkBvg7k8rC9nUrY15w7oALsfabtdF2GDCUVG5mpMMUwEWo4AwwMdEIX3+t7nzN4tmJI4/jOjC9PqtjJGljQs7u+jTJLFQPlbZYDRZLvk6hljPiC5594xiDTVktjNWXio2/n4NHIuvOPd3pIhxdXcnBZdKcMHAW5RHgdpddqfZ/6VFjS1y/7wmbIGIZidLyLMBqnttik61ywV0fu33WjXNtHd3/1k6+uxnylPCopQfP6Gn8A68qGBixg6otqrcOZfsr8xLGO6XBreCcZqHHAoZ9WfUwE9Jv9Nri9ZFSZlXrN/MahdvT5CYrrKEQppyjFIyMpKaYyODXJYznOsu6TzKAfwr4B5K+fIsqn7Xke8Rd7HYzBnRT/bkzD3cQcL8H1jjR73f92vEqgqouIeo37tD+xqRnkUtHgkXYL+lkBc0595+vWBN074LHBXO+6+16Vq7bHTjJRB6pyoj8nvPkT1dRAVhaWni+7TrVLh6rCIkHgDAEMAxMR8oeXKdMhnOZllC3EvEXaa56qDPOA8orBobcoc636E31f1QleJCpuD45dfqRsWwsg6R0i+zHUAk7kiBtkjmNK4hl7a5nPQ6DHm9ZBQmr5CsYYfUKGK0hfM8j30j4I5c4xAs2P1Q2MKp2YSmFhqVZ5iYobeTZ3dAiPp8zX6EWeH01ZyhW+QhrFNMWaexO9JCaGflIi5NKDo289JJzTHWnFlch+8IoQqp8XcBijSM2/0EVoCnhfCwERaCBpnGDB/JBdg9mSyUU7yloGkxXVATxJRXURXMxRqfXsZ77hCc8+idN9pE2/yUaMxnZizzb7CHT/SOgaB2Vaboyko0iUR47FzxXvCEJ PgxbeAU6 p4561POHTVcxyuy9Uv1oabOIp89CBzFBsWcyQBptJFpqx3jSuPNCk422bLYWhZ1tR6u1C7NR81CGGsYchAz8xp3ItCchHL/vaRsSa5FNchVJNVMe/DCLCdPMUA8jJnAQ4dpNGuNGRTi8K+OnO5HlrZeKy/Z7PNteqoyYMrha/5orRvzH48PRD7ZdIKtSEye8Wyd3iN4LF32h6GWgLd2+DTT3swLvzUlSu1yuWW5Cp622jsJ89u1wIX3kmP3qt98UloKM/NDNpM9VkG3E= 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 some write-side stats to count buffered writes, buffered writethrough, and writepages calls. Whilst we're at it, clean up the naming on some of the existing stats counters and organise the output into two sets. Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/buffered_read.c | 2 +- fs/netfs/buffered_write.c | 3 +++ fs/netfs/direct_write.c | 2 +- fs/netfs/internal.h | 7 +++++-- fs/netfs/stats.c | 17 ++++++++++++----- fs/netfs/write_issue.c | 1 + 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c index 47603f08680e..a6bb03bea920 100644 --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -282,7 +282,7 @@ int netfs_read_folio(struct file *file, struct folio *folio) if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS) goto discard; - netfs_stat(&netfs_n_rh_readpage); + netfs_stat(&netfs_n_rh_read_folio); trace_netfs_read(rreq, rreq->start, rreq->len, netfs_read_trace_readpage); /* Set up the output buffer */ diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c index 84ac95ee4b4d..33ea4c20e7e7 100644 --- a/fs/netfs/buffered_write.c +++ b/fs/netfs/buffered_write.c @@ -210,6 +210,9 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter, if (!is_sync_kiocb(iocb)) wreq->iocb = iocb; wreq->cleanup = netfs_cleanup_buffered_write; + netfs_stat(&netfs_n_wh_writethrough); + } else { + netfs_stat(&netfs_n_wh_buffered_write); } do { diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c index 2b81cd4aae6e..36b6db504500 100644 --- a/fs/netfs/direct_write.c +++ b/fs/netfs/direct_write.c @@ -145,7 +145,7 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from) return 0; trace_netfs_write_iter(iocb, from); - netfs_stat(&netfs_n_rh_dio_write); + netfs_stat(&netfs_n_wh_dio_write); ret = netfs_start_io_direct(inode); if (ret < 0) diff --git a/fs/netfs/internal.h b/fs/netfs/internal.h index dc11d1f67363..5d3f74a70fa7 100644 --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -106,9 +106,8 @@ int netfs_end_writethrough(struct netfs_io_request *wreq, struct kiocb *iocb); */ #ifdef CONFIG_NETFS_STATS extern atomic_t netfs_n_rh_dio_read; -extern atomic_t netfs_n_rh_dio_write; extern atomic_t netfs_n_rh_readahead; -extern atomic_t netfs_n_rh_readpage; +extern atomic_t netfs_n_rh_read_folio; extern atomic_t netfs_n_rh_rreq; extern atomic_t netfs_n_rh_sreq; extern atomic_t netfs_n_rh_download; @@ -125,6 +124,10 @@ extern atomic_t netfs_n_rh_write_begin; extern atomic_t netfs_n_rh_write_done; extern atomic_t netfs_n_rh_write_failed; extern atomic_t netfs_n_rh_write_zskip; +extern atomic_t netfs_n_wh_buffered_write; +extern atomic_t netfs_n_wh_writethrough; +extern atomic_t netfs_n_wh_dio_write; +extern atomic_t netfs_n_wh_writepages; extern atomic_t netfs_n_wh_wstream_conflict; extern atomic_t netfs_n_wh_upload; extern atomic_t netfs_n_wh_upload_done; diff --git a/fs/netfs/stats.c b/fs/netfs/stats.c index deeba9f9dcf5..0892768eea32 100644 --- a/fs/netfs/stats.c +++ b/fs/netfs/stats.c @@ -10,9 +10,8 @@ #include "internal.h" atomic_t netfs_n_rh_dio_read; -atomic_t netfs_n_rh_dio_write; atomic_t netfs_n_rh_readahead; -atomic_t netfs_n_rh_readpage; +atomic_t netfs_n_rh_read_folio; atomic_t netfs_n_rh_rreq; atomic_t netfs_n_rh_sreq; atomic_t netfs_n_rh_download; @@ -29,6 +28,10 @@ atomic_t netfs_n_rh_write_begin; atomic_t netfs_n_rh_write_done; atomic_t netfs_n_rh_write_failed; atomic_t netfs_n_rh_write_zskip; +atomic_t netfs_n_wh_buffered_write; +atomic_t netfs_n_wh_writethrough; +atomic_t netfs_n_wh_dio_write; +atomic_t netfs_n_wh_writepages; atomic_t netfs_n_wh_wstream_conflict; atomic_t netfs_n_wh_upload; atomic_t netfs_n_wh_upload_done; @@ -39,13 +42,17 @@ atomic_t netfs_n_wh_write_failed; int netfs_stats_show(struct seq_file *m, void *v) { - seq_printf(m, "Netfs : DR=%u DW=%u RA=%u RP=%u WB=%u WBZ=%u\n", + seq_printf(m, "Netfs : DR=%u RA=%u RF=%u WB=%u WBZ=%u\n", atomic_read(&netfs_n_rh_dio_read), - atomic_read(&netfs_n_rh_dio_write), atomic_read(&netfs_n_rh_readahead), - atomic_read(&netfs_n_rh_readpage), + atomic_read(&netfs_n_rh_read_folio), atomic_read(&netfs_n_rh_write_begin), atomic_read(&netfs_n_rh_write_zskip)); + seq_printf(m, "Netfs : BW=%u WT=%u DW=%u WP=%u\n", + atomic_read(&netfs_n_wh_buffered_write), + atomic_read(&netfs_n_wh_writethrough), + atomic_read(&netfs_n_wh_dio_write), + atomic_read(&netfs_n_wh_writepages)); seq_printf(m, "Netfs : ZR=%u sh=%u sk=%u\n", atomic_read(&netfs_n_rh_zero), atomic_read(&netfs_n_rh_short_read), diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c index 0293b714d8ee..11b62e6f82fa 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -510,6 +510,7 @@ int new_netfs_writepages(struct address_space *mapping, } trace_netfs_write(wreq, netfs_write_trace_writeback); + netfs_stat(&netfs_n_wh_writepages); do { _debug("wbiter %lx %llx", folio->index, wreq->start + wreq->submitted);