On Tue, 18 May 2021 17:45:18 +0200 Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > On 18.05.21 17:36, Claudio Imbrenda wrote: > > On Tue, 18 May 2021 17:05:37 +0200 > > Cornelia Huck <cohuck@xxxxxxxxxx> wrote: > >> Can too many not-yet-cleaned-up pages lead to a (temporary) memory > >> exhaustion? > > > > in case of reboot, not much; the pages were in use are still in use > > after the reboot, and they can be swapped. > > > > in case of a shutdown, yes, because the pages are really taken aside > > and cleared/destroyed in background. they cannot be swapped. they are > > freed immediately as they are processed, to try to mitigate memory > > exhaustion scenarios. > > > > in the end, this patchseries is a tradeoff between speed and memory > > consumption. the memory needs to be cleared up at some point, and that > > requires time. > > > > in cases where this might be an issue, I introduced a new KVM flag to > > disable lazy destroy (patch 10) > > Maybe we could piggy-back on the OOM-kill notifier and then fall back to > synchronous freeing for some pages? Sounds like a good idea. If delayed cleanup is safe, you probably want to have the fast shutdown behaviour.