summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_glue.c11
-rw-r--r--sys/vm/vm_meter.c5
-rw-r--r--sys/vm/vm_pageout.c8
3 files changed, 23 insertions, 1 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 849a30a..ea39d7f 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -74,9 +74,11 @@
#include <sys/sysctl.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/unistd.h>
#include <machine/limits.h>
+#include <machine/mutex.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -316,8 +318,11 @@ faultin(p)
s = splhigh();
- if (p->p_stat == SRUN)
+ if (p->p_stat == SRUN) {
+ mtx_enter(&sched_lock, MTX_SPIN);
setrunqueue(p);
+ mtx_exit(&sched_lock, MTX_SPIN);
+ }
p->p_flag |= P_INMEM;
@@ -332,6 +337,8 @@ faultin(p)
* This swapin algorithm attempts to swap-in processes only if there
* is enough space for them. Of course, if a process waits for a long
* time, it will be swapped in anyway.
+ *
+ * Giant is still held at this point, to be released in tsleep.
*/
/* ARGSUSED*/
static void
@@ -343,6 +350,8 @@ scheduler(dummy)
struct proc *pp;
int ppri;
+ mtx_assert(&Giant, MA_OWNED);
+
loop:
if (vm_page_count_min()) {
VM_WAIT;
diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c
index 66829bb..0f584c8 100644
--- a/sys/vm/vm_meter.c
+++ b/sys/vm/vm_meter.c
@@ -153,6 +153,7 @@ vmtotal(SYSCTL_HANDLER_ARGS)
case 0:
continue;
+ case SMTX:
case SSLEEP:
case SSTOP:
if (p->p_flag & P_INMEM) {
@@ -166,6 +167,10 @@ vmtotal(SYSCTL_HANDLER_ARGS)
continue;
break;
+ case SWAIT:
+ totalp->t_sl++;
+ continue;
+
case SRUN:
case SIDL:
if (p->p_flag & P_INMEM)
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 97b221e..d12ecac 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -78,6 +78,7 @@
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/kthread.h>
+#include <sys/ktr.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
#include <sys/vnode.h>
@@ -95,6 +96,8 @@
#include <vm/swap_pager.h>
#include <vm/vm_extern.h>
+#include <machine/mutex.h>
+
/*
* System initialization
*/
@@ -1280,6 +1283,9 @@ vm_size_t count;
static void
vm_pageout()
{
+
+ mtx_enter(&Giant, MTX_DEF);
+
/*
* Initialize some paging parameters.
*/
@@ -1399,6 +1405,8 @@ vm_daemon()
{
struct proc *p;
+ mtx_enter(&Giant, MTX_DEF);
+
while (TRUE) {
tsleep(&vm_daemon_needed, PPAUSE, "psleep", 0);
if (vm_pageout_req_swapout) {
OpenPOWER on IntegriCloud