On Tue, Dec 03, 2024 at 10:31:59AM +0800, Ze Zuo wrote: > The commit 0aef499f3172 ("mm/usercopy: Detect vmalloc overruns") introduced > vmalloc check for usercopy. However, in subsystems like networking, when > memory allocated using vmalloc or vmap is subsequently copied using > functions like copy_to_iter/copy_from_iter, the check is triggered. This > adds overhead in the copy path, such as the cost of searching the > red-black tree, which increases the performance burden. > > We found that after merging this patch, network bandwidth performance in > the XDP scenario significantly dropped from 25 Gbits/sec to 8 Gbits/sec, > the hardened_usercopy is enabled by default. > > To address this, we introduced a debugfs interface that allows selectively > enabling or disabling the vmalloc check based on the use case, optimizing > performance. > > By default, vmalloc check for usercopy is enabled. > > To disable the vmalloc check: > echo Y > /sys/kernel/debug/bypass_usercopy_vmalloc_check > > After executing the above command, the XDP performance returns to 25 > Gbits/sec. > To what Matthew has asked, could you please also specify the kernel version you run your experiment on? Apart of that please describe your system and HW. Thank you! -- Uladzislau Rezki