Section 9.3. Tracing the VM System


9.3. Tracing the VM System

There are only a few DTrace probes in the VM system at the time of writing specifically those via the sysinfo provider and those in the page_create() code-path. It is, however, possible to trace a larger portion of the VM, using the fbt provider.

sol10# ./gvm.sh >vm.d sol10# ./vm.d <pid> sol10# more vm.d :::BEGIN {         start = timestamp; } syscall::: /$target == pid/ {         trace((timestamp - start) / 1000); } ::add_physmem:, ::sptcreate:, ... ::sptdestroy:, ::va_to_pfn: /$target == pid/ {         trace((timestamp - start) / 1000); } 


Running the VM trace script on a target process allows you to observe the VM level tasks of a target process. A simple example might be to trace the entire code path for a specific VM operation, however this often results in too many probes, creating significant probe effect. A simple script allows us to instrument just the VM system, by converting the function prototypes from the VM header files and auto-generating a DTrace script. This technique instruments just the perimeters of the VM modules we care aboutaddress spaces, segments, and page level interfaces.

0  => munmap                                              3194 0    -> as_unmap                                          3199 0      -> as_findseg                                      3206 0      <- as_findseg                                      3209 0      -> segvn_unmap                                     3211 0        -> segvn_lockop                                  3217 0        <- segvn_lockop                                  3219 0        -> hat_unload_callback                           3221 0          -> page_get_pagesize                           3236 0          <- page_get_pagesize                           3237 0          -> hat_page_setattr                            3239 0          <- hat_page_setattr                            3240 0          -> free_vp_pages                               3247 0            -> page_share_cnt                            3252 0              -> hat_page_getshare                       3255 0              <- hat_page_getshare                       3256 0            <- page_share_cnt                            3258 0          <- free_vp_pages                               3259 0        <- hat_unload_callback                           3261 0        -> seg_free                                      3263 0          -> as_removeseg                                3265 0          <- as_removeseg                                3270 0          -> segvn_free                                  3272 0            -> segvn_lockop                              3273 0            <- segvn_lockop                              3274 0          <- segvn_free                                  3279 0        <- seg_free                                      3281 0      <- segvn_unmap                                     3282 0    <- as_unmap                                          3284 0  <= munmap                                              3286 


In this example, we can see the munmap() system call's implementationa munmap() request calls into the AS layer to locate a mapping for a given address, which searches the AVL tree for the target address space, locating all the mappings within the specified addresses. For each mapping, the AS layer calls the appropriate segment driver, which contains the majority of the unmap implementation for this address range. In this example, the seg_vn driver calls into the HAT to unload the MMU mappings for each of the pages within the supplied addresses.




SolarisT Internals. Solaris 10 and OpenSolaris Kernel Architecture
Solaris Internals: Solaris 10 and OpenSolaris Kernel Architecture (2nd Edition)
ISBN: 0131482092
EAN: 2147483647
Year: 2004
Pages: 244

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net