aufs: reduce overhead for "code present but disabled" use case.
The AUFS code introduces a new mm/prfile.c which is used to hook in a shadow structure plus some __FUNC__ and __LINE__ tracing via hijacking some fs/file and mm/vma calls (see aufs5-standalone/aufs5-mmap.patch). As these tiny stubs live in a separate source module, we are always going to be bouncing through them, even with AUFS completely disabled. We also see AUFS adding some content to existing structs even with AUFS disabled. We can fix the 1st by getting rid of prfile.c in the disabled case; we replace it with macros that collapse to the original unpatched code. We can fix the latter by using IS_ENABLED(CONFIG_AUFS_FS) around the extra content AUFS adds/changes so they aren't present when disabled. This covers both the CONFIG_AUFS_FS=m and CONFIG_AUFS_FS=y cases. Finally, there is the deprecated remap_file_pages() syscall - and while it has been deprecated since 2014 - it does add unused code and possibly exposure to regressions/CVE etc. - and so I also used the very same IS_ENABLED() there so we have the original code in the disabled case. The size difference for the disabled case is easy to detect/display. Functions found in prfile.c show up as "-" below since it isn't built: linux-yocto$ size ../aufs*/vmlinux text data bss dec hex filename 20176019 8124604 2019564 30320187 1cea63b ../aufs-debloat/vmlinux 20176259 8124604 2019564 30320427 1cea72b ../aufs-default/vmlinux linux-yocto$./scripts/bloat-o-meter ../aufs-default/vmlinux ../aufs-debloat/vmlinux add/remove: 0/4 grow/shrink: 0/14 up/down: 0/-871 (-871) Function old new delta filemap_page_mkwrite 252 247 -5 gate_vma 200 192 -8 mmap_region 1528 1517 -11 __vma_adjust 2357 2345 -12 remove_vma 104 91 -13 dup_mm.isra 1403 1387 -16 map_files_get_link 429 408 -21 copy_vma 597 576 -21 __split_vma 420 394 -26 show_numa_map 944 917 -27 vma_do_pr_or_file 29 - -29 vma_do_get_file 35 - -35 show_map_vma 350 310 -40 vma_do_fput 47 - -47 vma_do_file_update_time 47 - -47 __func__ 17583 17424 -159 __ia32_sys_remap_file_pages 786 623 -163 __x64_sys_remap_file_pages 817 626 -191 Total: Before=17285664, After=17284793, chg -0.01% linux-yocto$ Performance should be restored to the original non-AUFS baseline given the above reduction in code and removal of out-of-line stubs. Signed-off-by:Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by:
Bruce Ashfield <bruce.ashfield@gmail.com>
Loading
Please register or sign in to comment