summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-04-04 22:08:03 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-04-04 22:08:03 +0000
commit5eed774d1c6d3bf86479cd011250616419371255 (patch)
tree1049fb157f94f06eab2c92425fc1631a6c27457e
parent3a944f1099b50247da0339e37ab7668b1a0dd37c (diff)
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@
-rw-r--r--sys/uvm/uvm_pdaemon.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c
index a6f643f24bf..834226f68a2 100644
--- a/sys/uvm/uvm_pdaemon.c
+++ b/sys/uvm/uvm_pdaemon.c
@@ -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();