mirror of
https://github.com/openbsd/src.git
synced 2026-06-17 23:03:29 +02:00
Tweak the code that wakes up uvm_pmalloc sleepers in the page daemin.
Although there are open questions about whether we should flag failures with UVM_PMA_FAIL or not, we really should only wake up a sleeper if we unlink the pma. For now only do that if pages were actually freed in the requested region. Prompted by: CID 1453061 Logically dead code which should be fixed by this commit. ok (and together with) beck@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uvm_pdaemon.c,v 1.85 2019/12/30 23:58:38 jsg Exp $ */
|
||||
/* $OpenBSD: uvm_pdaemon.c,v 1.86 2020/04/04 22:08:02 kettenis Exp $ */
|
||||
/* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
@@ -210,7 +210,6 @@ uvm_pageout(void *arg)
|
||||
{
|
||||
struct uvm_constraint_range constraint;
|
||||
struct uvm_pmalloc *pma;
|
||||
int work_done;
|
||||
int npages = 0;
|
||||
|
||||
/* ensure correct priority and set paging parameters... */
|
||||
@@ -223,7 +222,6 @@ uvm_pageout(void *arg)
|
||||
|
||||
for (;;) {
|
||||
long size;
|
||||
work_done = 0; /* No work done this iteration. */
|
||||
|
||||
uvm_lock_fpageq();
|
||||
if (!uvm_nowait_failed && TAILQ_EMPTY(&uvm.pmr_control.allocs)) {
|
||||
@@ -282,7 +280,6 @@ uvm_pageout(void *arg)
|
||||
((uvmexp.free - BUFPAGES_DEFICIT) < uvmexp.freetarg) ||
|
||||
((uvmexp.inactive + BUFPAGES_INACT) < uvmexp.inactarg)) {
|
||||
uvmpd_scan();
|
||||
work_done = 1; /* XXX we hope... */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -296,15 +293,18 @@ uvm_pageout(void *arg)
|
||||
}
|
||||
|
||||
if (pma != NULL) {
|
||||
/*
|
||||
* XXX If UVM_PMA_FREED isn't set, no pages
|
||||
* were freed. Should we set UVM_PMA_FAIL in
|
||||
* that case?
|
||||
*/
|
||||
pma->pm_flags &= ~UVM_PMA_BUSY;
|
||||
if (!work_done)
|
||||
pma->pm_flags |= UVM_PMA_FAIL;
|
||||
if (pma->pm_flags & (UVM_PMA_FAIL | UVM_PMA_FREED)) {
|
||||
if (pma->pm_flags & UVM_PMA_FREED) {
|
||||
pma->pm_flags &= ~UVM_PMA_LINKED;
|
||||
TAILQ_REMOVE(&uvm.pmr_control.allocs, pma,
|
||||
pmq);
|
||||
wakeup(pma);
|
||||
}
|
||||
wakeup(pma);
|
||||
}
|
||||
uvm_unlock_fpageq();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user