Where are gnome page faults generated?

I dialed into some sessions of jmr's desktop summit which weren't too late for those of us on Irish time. It would have been nice to meet the engineers in person, it was really a worthwhile exchange of ideas.

Gman mentioned that someone in the Gnome community was interested in whether it would be possible to use dtrace to get a stack trace of all gnome code being executed when a page fault occurs. So I learned about the vminfo provider from the dtrace manual and from Richard McDougall's blog. Richard has some vminfo scripts which measure the time spent in pagefaults. Here is my attempt at a "Where is GNOME paging?" script:

#!/usr/sbin/dtrace -s
vminfo:::pgpgin
/uid ==$1/
{
        @[execname,arg0,ustack()] = count();
}
It's too simple isn't it? But does it work? I logout of gnome, do a lockfs -f / and run the script before logging in to gnome.
...{stuff deleted}
 gconfd-2                                                          1
              libc.so.1`_xstat+0x15
              libgconfbackend-xml.so`load_subdirs+0x18f
              libgconfbackend-xml.so`markup_tree_get_dir_internal+0x7c
              libgconfbackend-xml.so`markup_tree_lookup_dir+0x16
              libgconfbackend-xml.so`query_value+0x71
              libgconf-2.so.4.1.0`gconf_source_query_value+0x10c
              libgconf-2.so.4.1.0`hash_lookup_defaults_func+0x10a
              libglib-2.0.so.0.800.3`g_hash_table_foreach+0x60
              libgconf-2.so.4.1.0`gconf_sources_all_entries+0x41a
              gconfd-2`gconf_database_all_entries+0x85
              gconfd-2`impl_ConfigDatabase2_all_entries_with_schema_name+0x43
              libgconf-2.so.4.1.0`_ORBIT_skel_small_ConfigDatabase2_all_entries_with_schema_name+0x2d
              libORBit-2.so.0.0.0`ORBit_POAObject_invoke+0x23
              libORBit-2.so.0.0.0`ORBit_OAObject_invoke+0x21
              libORBit-2.so.0.0.0`ORBit_small_invoke_adaptor+0x2c6
              libORBit-2.so.0.0.0`ORBit_POAObject_handle_request+0x327
              libORBit-2.so.0.0.0`ORBit_POA_handle_request+0x30f
              libORBit-2.so.0.0.0`ORBit_handle_request+0xed
              libORBit-2.so.0.0.0`giop_connection_handle_input+0x2f1
              libORBit-2.so.0.0.0`link_connection_io_handler+0x4f
               86
  bonobo-activatio                                                  2
              libc.so.1`_read+0x15
              libc.so.1`fread+0xcc
              libz.so.1`get_byte+0x3f
              libz.so.1`check_header+0x1d
              libz.so.1`gz_open+0x1f5
              libz.so.1`gzopen+0x10
              libxml2.so.2.6.19`xmlGzfileOpen+0x8c
              libxml2.so.2.6.19`__xmlParserInputBufferCreateFilename+0x6d
              libxml2.so.2.6.19`xmlParserInputBufferCreateFilename+0x3c
              libxml2.so.2.6.19`xmlNewInputFromFile+0x3f
              libxml2.so.2.6.19`xmlDefaultExternalEntityLoader+0x26a
              libxml2.so.2.6.19`xmlLoadExternalEntity+0x6b
              libxml2.so.2.6.19`xmlCreateFileParserCtxt+0x40
              bonobo-activation-server`bonobo_server_info_load+0xef
              bonobo-activation-server`bonobo_object_directory_init+0x13d
              bonobo-activation-server`main+0x2ea
              bonobo-activation-server`0x805555e
              99
... {stuff deleted}

gnome-session                                                     1
              libc.so.1`__open+0x15
              libc.so.1`_endopen+0x85
              libc.so.1`fopen+0x29
              libfontconfig.so.1.0.4`FcDirCacheReadDir+0x69
              libfontconfig.so.1.0.4`FcDirScanConfig+0x64
              libfontconfig.so.1.0.4`FcConfigBuildFonts+0xac
              libfontconfig.so.1.0.4`FcInit+0x55
              libfontconfig.so.1.0.4`FcConfigGetCurrent+0x24
              libfontconfig.so.1.0.4`FcConfigSubstituteWithPat+0x26
              libfontconfig.so.1.0.4`FcConfigSubstitute+0x23
              libpangocairo-1.0.so.0.1001.0`pango_cairo_fc_font_map_context_substitute+0x21
              libpangoft2-1.0.so.0.1001.0`pango_fc_default_substitute+0x30
              libpangoft2-1.0.so.0.1001.0`pango_fc_font_map_get_patterns+0x28f
              libpangoft2-1.0.so.0.1001.0`pango_fc_font_map_load_fontset+0x39
              libpango-1.0.so.0.1001.0`pango_font_map_load_fontset+0x3b
              libpango-1.0.so.0.1001.0`itemize_state_update_for_new_run+0x14a
              libpango-1.0.so.0.1001.0`itemize_state_process_run+0x21
              libpango-1.0.so.0.1001.0`pango_itemize_with_base_dir+0x75
              libpango-1.0.so.0.1001.0`pango_layout_check_lines+0x308
              libpango-1.0.so.0.1001.0`pango_layout_get_extents_internal+0x2f
              146
...{stuff deleted}

There are no comments in the script and I didn't put headings on the printout so here is what it does: Whenever there is a pagefault AND uid = {command line argument 1}, the pgpgin probe puts the number of pages requested into arg0. I aggregate this along with the user stack and the name of the process which generated the page fault. So in the above example, gnome-session with this ustack page faults 146 times during login while requesting 1 page each time. Here is the entire pagefault output during login and here are the page faults which occur when gnome-calculator is launched.

It seems almost too easy, doesn't it? If this is wrong, I hope a dtrace expert will correct me. Padraig and the desktop summit attendees are already looking at linker options which could reduce paging but it would take someone who knows gnome libraries better than I to know whether this output highlights any problems.

Note:I suppose there is some irony in the fact that while investigating this, my cursed linux laptop kept going catatonic on me. Top, vmstat... showed that everything was just dandy. Does anyone have a simple suggestion for diagnosing severe linux performance issues not seen by top? I really don't have time to mess with this. Aaaargh! The biggest problem with dtrace is that it makes me wish I had it for linux, and OSX... and Microsoft Windows.

Update: As if those dtrace guys were reading my mind with the user::whatIwish4:now probe, it's now possible to dtrace a linux application with BrandZ. Spooky.

Comments:

Thanks for making this.

Posted by bkor on December 13, 2005 at 09:47 AM GMT+00:00 #

bkor:No problem! I hope someone finds the data useful.

Posted by bnitz on December 13, 2005 at 10:11 AM GMT+00:00 #

Would it be possible to show some distinction between data and instruction page faults?

Posted by d on December 13, 2005 at 10:17 AM GMT+00:00 #

d: Yes, you'd use the following probes:

execpgin:
Probe that fires whenever an executable page is paged in from the backing store.

fspgin:
Probe that fires whenever a file system page is paged in from the backing store.

anonpgin:
Probe that fires whenever an anonymous page is paged in from a swap device.

Posted by bnitz on December 13, 2005 at 02:14 PM GMT+00:00 #

Post a Comment:
  • HTML Syntax: NOT allowed
About

bnitz

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today