Download raw body.
pdaemon, interrupts and ci_idepth
On Sat, Oct 19, 2024 at 03:23:32PM +0200, Martin Pieuchot wrote:
> When a system is OOM and has only its reserved pages available, it is
> not helpful to let interrupt handlers steal such memory from the page
> daemon.
>
> I've seen iwm(4)'s interrupt handler allocate memory reserved for the
> pagedaemon because checking against `curproc' is not good enough. So
> the diff below use the MD `ci_idepth' variable to prevent such scenario.
> If this is acceptable, I'd be happy to rename `ci_intrdepth' used by
> some architectures to `ci_idepth'.
>
> Ok?
archs with neither ci_idepth or ci_intrdepth: sparc64, hppa, landisk
hppa has ci_in_intr
An MI interface could also be used in drm in_irq().
>
> diff --git sys/uvm/uvm_pmemrange.c sys/uvm/uvm_pmemrange.c
> index 0dff15f6cee..611d6d2785d 100644
> --- sys/uvm/uvm_pmemrange.c
> +++ sys/uvm/uvm_pmemrange.c
> @@ -967,7 +967,8 @@ again:
> }
>
> if ((uvmexp.free <= (uvmexp.reserve_pagedaemon + count)) &&
> - (curproc != uvm.pagedaemon_proc) && (curproc != syncerproc)) {
> + (((curproc != uvm.pagedaemon_proc) && (curproc != syncerproc)) ||
> + (curcpu()->ci_idepth > 0))) {
> uvm_unlock_fpageq();
> if (flags & UVM_PLA_WAITOK) {
> uvm_wait("uvm_pmr_getpages");
> @@ -2095,7 +2096,7 @@ uvm_wait_pla(paddr_t low, paddr_t high, paddr_t size, int failok)
> struct uvm_pmalloc pma;
> const char *wmsg = "pmrwait";
>
> - if (curproc == uvm.pagedaemon_proc) {
> + if (curproc == uvm.pagedaemon_proc && curcpu()->ci_idepth == 0) {
> /*
> * This is not that uncommon when the pagedaemon is trying
> * to flush out a large mmapped file. VOP_WRITE will circle
>
>
pdaemon, interrupts and ci_idepth