From: Jan Beulich Date: Fri, 29 Jan 2021 10:34:37 +0000 (+0100) Subject: memory: bail from page scrubbing when CPU is no longer online X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~1011 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3c9fd69416f8ffc611705fb24dfb383203ddc84f;p=xen.git memory: bail from page scrubbing when CPU is no longer online Scrubbing can significantly delay the offlining (parking) of a CPU (e.g. because of booting into in smt=0 mode), to a degree that the "CPU still not dead..." messages logged on x86 in 1s intervals can be seen multiple times. There are no softirqs involved in this process, so extend the existing preemption check in the scrubbing logic to also exit when the CPU is no longer observed online. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index fcb308d92f..02ac1fa613 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1324,9 +1324,11 @@ bool scrub_free_pages(void) * Scrub a few (8) pages before becoming eligible for * preemption. But also count non-scrubbing loop iterations * so that we don't get stuck here with an almost clean - * heap. + * heap. Consider the CPU no longer being seen as online as + * a request to preempt immediately, to not unduly delay + * its offlining. */ - if ( cnt > 800 && softirq_pending(cpu) ) + if ( !cpu_online(cpu) || (cnt > 800 && softirq_pending(cpu)) ) { preempt = true; break;