On 6/18/25 3:42 AM, Yunshui Jiang wrote:
From: jiangyunshui <jiangyunshui@xxxxxxxxxx>
Since commit bcd51a3c679d ("hugetlb: lazy page table copies
in fork()"), the logic about judging whether to copy
page table inside func copy_page_range has been extracted
into a separate func vma_needs_copy. While this change
improves code readability, it also incurs more function call
overhead, especially where fork() were frequently called.
Inline func vma_needs_copy to optimize the copy_page_range
performance. Given that func vma_needs_copy is only called
by copy_page_range, inlining it would not cause unacceptable
code bloat.
I'm surprised the compiler doesn't inline it already, if there's a
single caller. In fact, mine (gcc-14.3 on x86) already does.
So I wonder to which extent should we force override wrong compiler
heuristics?
Maybe just inline instead of __always_inline would be OK? Is
that enough of a hint for your compiler?