Re: linux-next regression: SNP Guest boot hangs with certain cpu/mem config combination

From: Kirill A. Shutemov
Date: Fri Mar 28 2025 - 06:54:56 EST


On Fri, Mar 28, 2025 at 10:33:31AM +0100, Ard Biesheuvel wrote:
> Can you quantify the speedup?

Test is below. I run it 10 times on a VM without unaccepted memory. With
and without has_unaccepted_memory() check in cond_accept_memory().

The difference is not huge, but it is there:

Without static branch: Mean: 35559993 us, StdDev: 167264
With static branch: Mean: 35286227 us, StdDev: 207595
Diff: -273766 us / -0.77%

static int __init alloc_test(void)
{
ktime_t start_time, end_time;
s64 delta, total = 0;
struct page *page;
int i, j;

for (i = 0; i < 10; i++) {
start_time = ktime_get();
for (j = 0; j < 100000; j++) {
page = alloc_pages(GFP_KERNEL, PMD_ORDER);
__free_pages(page, PMD_ORDER);
}
end_time = ktime_get();
printk("%d: %lld us\n", i, ktime_us_delta(end_time, start_time));
}

for (i = 0; i < 100; i++) {
start_time = ktime_get();
for (j = 0; j < 100000; j++) {
page = alloc_pages(GFP_KERNEL, PMD_ORDER);
__free_pages(page, PMD_ORDER);
}
end_time = ktime_get();
delta = ktime_us_delta(end_time, start_time);
total += delta;
printk("%d: %lld us\n", i, delta);
}

printk("total: %lld us\n", total);

return 0;
}
late_initcall(alloc_test);
--
Kiryl Shutsemau / Kirill A. Shutemov