public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Daire Byrne <daire@dneg.com>
To: William Cohen <wcohen@redhat.com>
Cc: "systemtap@sourceware.org" <systemtap@sourceware.org>
Subject: Re: vfs.add_to_page_cache not working anymore?
Date: Tue, 13 Jun 2023 17:39:08 +0100	[thread overview]
Message-ID: <CAPt2mGNCxLwDZRePoJdU9fezL8kcQQnRdspbQncb4U6xbMLxUQ@mail.gmail.com> (raw)
In-Reply-To: <4893d129-6569-4318-cf3b-7821bef98441@redhat.com>

On Tue, 13 Jun 2023 at 16:22, William Cohen <wcohen@redhat.com> wrote:>
> Switching to systemtap-4.9 is probably not going to change the results
> in this case as there are no changes in tapset/linux/vfs.stp between
> 4.8 and 4.9.

Good to know, I can skip trying to compile that then...

> Unfortunately, the kernels changes over time and some functions probed
> by the tapset change over time or the way they are used by other parts
> of the kernel changes.  The vfs.add_to_page cache in the vfs.stp has
> three possible functions it probes: add_to_page_cache_locked,
> add_to_page_cache_lru, and add_to_page_cache.  The first two functions
> were added due to kernel commit f00654007fe1c15.  Did some git commit
> archeology and only add_to_page_cache_lru is in the kernel due to
> kernel git commit 2bb876b58d593d7f2522ec0f41f20a74fde76822.
>
> The following URL show where add_to_page_cache_lru is used in 6.2.16
> kernels nfs and can provide some method of seeing how the nfs related
> functions get called:
>
> https://elixir.bootlin.com/linux/v6.2.16/A/ident/add_to_page_cache_lru

Thanks for the feedback and pointers, that helps me understand where
the changes came from at least. It was still working on my last
production kernel - v5.16.

So if I recall, I used vfs.add_to_page cache because at the time it
was the only (or easiest) way to work out total reads for mmap files
from an NFS filesystem.

I also would have thought it should work for any filesystem not just
NFS - but I don't get any hits at all for an entire busy system.

> As far as specifically what has changed to cause vfs.add_to_page_cache
> not to trigger for NFS operations I am not sure.  For the 6.2 kernel
> it might be good to get a backtrace of the triggering of it and then
> use that information to see what has changed in the functions on the
> backtrace.
>
> stap -ldd -e 'probe vfs.add_to_page_cache { print_backtrace(); printf("Works.\n"); exit() }'

I just get the error "Cannot specify a script with -l/-L/--dump-*
switches" using systemtap v4.8.

Thanks for the response. It sounds like I need to find a different way
to work out total NFS reads for each filename path in modern kernels.

Daire

BTW, this is the code I had for tracking per process and file path read IO:

probe nfs.fop.open {
  pid = pid()
  filename = sprintf("%s", d_path(&$filp->f_path))
  if (filename =~ "/hosts/.*/user_data") {
    files[pid, ino] = filename
    if ( !([pid, ino] in procinfo))
      procinfo[pid, ino] = sprintf("%s", proc())
  }
}

probe vfs.add_to_page_cache {
  pid = pid()
  if ([pid, ino] in files ) {
    readpage[pid, ino] += 4096
    files_store[pid, ino] = sprintf("%s", files[pid, ino])
  }
}

  reply	other threads:[~2023-06-13 16:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 15:39 Daire Byrne
2023-06-13 15:22 ` William Cohen
2023-06-13 16:39   ` Daire Byrne [this message]
2023-06-13 17:34     ` William Cohen
2023-06-14 12:11       ` Daire Byrne
2023-06-14 15:58         ` Daire Byrne
2023-11-06 11:20           ` Daire Byrne

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=CAPt2mGNCxLwDZRePoJdU9fezL8kcQQnRdspbQncb4U6xbMLxUQ@mail.gmail.com \
    --to=daire@dneg.com \
    --cc=systemtap@sourceware.org \
    --cc=wcohen@redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).