Re: [Patch] Losing many samples when profiling multiple JVMs
大平怜 <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <CAERM-Pifc6GXOzGU95pc58Jj19u6Umm-dV2EP+dEqdhXj1Hffw@mail.gmail.com> |
Hi, Anyone has any suggestions? I hope my patch is included in OProfile-1.1. Thanks, Rei Odaira 2015-05-31 22:00 GMT-05:00 大平怜 <[email protected]>: > Hi, > > I found when profiling multiple JVMs, many samples that should have hit > JITted methods were lost due to no permanent mapping. This was because > OProfile did not have correct operf_mmap for the JITted code anon regions > of some of the JVMs. This error can happen as follows: > > (1) __handle_mmap_event() creates a new operf_mmap for a small anon region > of a JVM. > (2) When another JVM happens to allocate its anon region at the same > starting virtual address but with a larger size, __handle_mmap_event() > first searches all_images_map. > (3) __handle_mmap_event() finds the previously created operf_mmap in > all_images_map and reuses it, because it checks only filename and > start_addr. > (4) As a result, when a sample hits a JITted method that was generated > between the incorrect end_addr and the actual end > address, __get_operf_trans() cannot find an appropriate mapping. > > The root cause of this problem is that __handle_mmap_event() does not > check end_addr when searching all_images_map. This should work for a normal > file, which should have the same size when mapped to different processes, > but not for anon regions, which can have different sizes in different > processes. The attached patch will add this check. > > More fundamentally, I am wondering what the purpose of all_images_region > is. I guess it is to reuse operf_mmap structures for more than one > processes. The file names in all_images_map are stored in absolute paths, > but they are compared against a file base name in __handle_mmap_event(). As > a result, this comparison succeeds only for anon and [vdso]. Is this > intended behavior? > > > Regards, > Rei Odaira > ------------------------------------------------------------------------------ _______________________________________________ oprofile-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oprofile-list