linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>, Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Subject: [RFC PATCH 0/3] Generic per-mount io stats
Date: Thu,  7 Jan 2021 23:43:58 +0200	[thread overview]
Message-ID: <20210107214401.249416-1-amir73il@gmail.com> (raw)

Miklos,

I was trying to address the lack of iostat report for non-blockdev
filesystems such as overlayfs and fuse.

NFS has already addressed this with it own custom stats collection,
which is displayed in /proc/<pid>/mountstats.

When looking at the options, I found that a generic solution is quite
simple and could serve all filesystems that opt-in to use it.

This short patch set results in the following mountstats example report:

device overlay mounted on /mnt with fstype overlay
	times: 125 153
	rchar: 12
	wchar: 0
	syscr: 2
	syscw: 0

The choise to collect and report io stats by mount and not by sb is
quite arbitrary, because it was quite easy to implement and is natural
to the existing mountstats proc file.

I used the arbirtaty flag FS_USERNS_MOUNT as an example for a way for
filesystem to opt-in to mount io stats, but it could be either an FS_
SB_ or MNT_ flag.  I do not anticipate shortage of opinions on this
matter.

As for performance, the io accounting hooks are the existing hooks for
task io accounting.  mount io stats add a dereference to mnt_pcp for
the filesystems that opt-in and one per-cpu var update.  The dereference
to mnt_sb->s_type->fs_flags is temporary as we will probably want to
use an MNT_ flag, whether kernel internal or user controlled.

What do everyone think about this?

Al,

did I break any subtle rules of the vfs?

Thanks,
Amir.

Amir Goldstein (3):
  fs: add iostats counters to struct mount
  fs: collect per-mount io stats
  fs: report per-mount io stats

 fs/Kconfig          |  9 +++++
 fs/mount.h          | 54 ++++++++++++++++++++++++++++
 fs/namespace.c      | 19 ++++++++++
 fs/proc_namespace.c | 13 +++++++
 fs/read_write.c     | 87 ++++++++++++++++++++++++++++++++-------------
 5 files changed, 158 insertions(+), 24 deletions(-)

-- 
2.25.1


             reply	other threads:[~2021-01-07 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 21:43 Amir Goldstein [this message]
2021-01-07 21:43 ` [RFC PATCH 1/3] fs: add iostats counters to struct mount Amir Goldstein
2021-01-07 21:44 ` [RFC PATCH 2/3] fs: collect per-mount io stats Amir Goldstein
2021-01-07 21:44 ` [RFC PATCH 3/3] fs: report " Amir Goldstein
2021-01-08 16:41 ` [RFC PATCH 0/3] Generic " Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107214401.249416-1-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).