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@xxxxxxxxxxxxx> 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 ;-)