• 嗷大墨's avatar
    mm: page_alloc: Add a tracepoint to trace the call of __alloc_pages() · f2bae51b
    嗷大墨 提交于
    openeuler inclusion
    category: feature
    bugzilla: https://portrait.gitee.com/openeuler/open-source-summer/issues/I56LAR
    CVE: NA
    
    ----------------------------------------------------------------------
    
    /proc/meminfo is the main way for user to know the physical memory
    usage, but it cannot know every operation of allocating physical
    pages. Some kernel modules can call alloc_pages to get physical
    pages directly, which part of physical memory will not be counted
    by /proc/meminfo.
    
    In order to trace the specific process of physical page allocation
    and release, one solution is to use ebpf to trace the calls of
    __alloc_pages and __free_pages, a better solution is to insert
    a new modules into kernel and register tracepoint handlers to
    obtain the physical page allocation information. So i also export
    the relative tracepoint symbols so that kernel module can use them.
    
    Physical pages allocation may be a time-consuming operation, so i
    added a new tracepoint named mm_page_alloc_enter at the entrance of
    __alloc_pages. Before that, a tracepoint has been added in the
    kernel at the end of the page allocation operation. The tracepoints
    can be used to calculate the time consumption of the allocation
    operation.
    Signed-off-by: 嗷大墨's avatarGong Yuchen <gyc8787@163.com>
    f2bae51b
page_alloc.c 258.9 KB