linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, bpf@vger.kernel.org,
	Joel Fernandes <joel@joelfernandes.org>,
	Brian Norris <briannorris@chromium.org>,
	Ching-lin Yu <chinglinyu@google.com>
Subject: Re: [LSF/MM/BPF TOPIC] tracing mapped pages for quicker boot performance
Date: Thu, 12 Jan 2023 22:24:53 +0000	[thread overview]
Message-ID: <Y8CItRIuL3KUqUlk@casper.infradead.org> (raw)
In-Reply-To: <20230112171759.70132384@gandalf.local.home>

On Thu, Jan 12, 2023 at 05:17:59PM -0500, Steven Rostedt wrote:
> On Thu, 12 Jan 2023 20:35:53 +0000
> Matthew Wilcox <willy@infradead.org> wrote:
> 
> > On Thu, Jan 12, 2023 at 01:21:53PM -0500, Steven Rostedt wrote:
> > > What I would like to discuss, is if there could be a way to add some sort
> > > of trace events that can tell an application exactly what pages in a file
> > > are being read from disk, where there is no such races. Then an application
> > > would simply have to read this information and store it, and then it can
> > > use this information later to call readahead() on these locations of the
> > > file so that they are available when needed.  
> > 
> > trace_mm_filemap_add_to_page_cache()?
> 
> Great! How do I translate this to files? Do I just do a full scan on the
> entire device to find which file maps to an inode? And I'm guessing that
> the ofs is the offset into the file?

'ofs' is, yes.  That should have been called 'pos'.

And as you know, inodes can have multiple names in the filesystem.
I imagine you'd want to trace open() to see which names are being
opened; you can fstat the fd to build the ino->name lookup.

> (from a 5.10 modified kernel)
> 
>             <...>-177   [001]    13.166966: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a0 pfn=2586272 ofs=1204224
>             <...>-177   [001]    13.166968: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a1 pfn=2586273 ofs=1208320
>             <...>-177   [001]    13.166968: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a2 pfn=2586274 ofs=1212416
>             <...>-177   [001]    13.166969: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a3 pfn=2586275 ofs=1216512
>             <...>-177   [001]    13.166970: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a4 pfn=2586276 ofs=1220608
>             <...>-177   [001]    13.166971: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a5 pfn=2586277 ofs=1224704
>             <...>-177   [001]    13.166972: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a6 pfn=2586278 ofs=1228800
>             <...>-177   [001]    13.166972: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a7 pfn=2586279 ofs=1232896
>             <...>-177   [001]    13.166973: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a8 pfn=2586280 ofs=1236992
>             <...>-177   [001]    13.166974: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776a9 pfn=2586281 ofs=1241088
>             <...>-177   [001]    13.166979: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776aa pfn=2586282 ofs=1245184
>             <...>-177   [001]    13.166980: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776ab pfn=2586283 ofs=1249280
>             <...>-177   [001]    13.166981: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776ac pfn=2586284 ofs=1253376
>             <...>-177   [001]    13.166981: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776ad pfn=2586285 ofs=1257472
>             <...>-177   [001]    13.166982: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776ae pfn=2586286 ofs=1261568
>             <...>-177   [001]    13.166983: mm_filemap_add_to_page_cache: dev 259:5 ino 9b11 page=0x2776af pfn=2586287 ofs=1265664
> 
> The dev 259:5 is the root partition.
> 
> Doing the following:
> 
>  $ printf "%d\n" 0x9b11
> 39697
> 
>  $ sudo find / -xdev -inum 39697
> /lib64/libc.so.6
> 
> I guess that's what I need to do. Thanks!
> 
> I'll try it out. But I'd still like to have an invite as I have lots of
> other fun stuff to talk to you all about (mm, fs, and BPF) ;-)

Your topic doesn't have to get selected to receive an invite ;-)


  reply	other threads:[~2023-01-12 22:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 18:21 Steven Rostedt
2023-01-12 20:35 ` Matthew Wilcox
2023-01-12 22:17   ` Steven Rostedt
2023-01-12 22:24     ` Matthew Wilcox [this message]
2023-01-12 22:30       ` Steven Rostedt

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=Y8CItRIuL3KUqUlk@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=bpf@vger.kernel.org \
    --cc=briannorris@chromium.org \
    --cc=chinglinyu@google.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=rostedt@goodmis.org \
    /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