summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2013-07-24 09:45:31 +0000
committeravg <avg@FreeBSD.org>2013-07-24 09:45:31 +0000
commit9e6374b6a9ee35bc4eb4e1d73c4942b4b2391e57 (patch)
tree86485591661a4e2aaffdc78caab463f4b4f101f9 /sys/vm
parent0a4136d3530f88ddcec3af09ad403f557fba393b (diff)
downloadFreeBSD-src-9e6374b6a9ee35bc4eb4e1d73c4942b4b2391e57.zip
FreeBSD-src-9e6374b6a9ee35bc4eb4e1d73c4942b4b2391e57.tar.gz
rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST
Also directly call swapper() at the end of mi_startup instead of relying on swapper being the last thing in sysinits order. Rationale: - "RUN_SCHEDULER" was misleading, scheduling already takes place at that stage - "scheduler" was misleading, the function swaps in the swapped out processes - another SYSINIT(SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY) could never be invoked depending on its relative order with scheduler; this was not obvious and the bug actually used to exist Reviewed by: kib (ealier version) MFC after: 14 days
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm.h1
-rw-r--r--sys/vm/vm_glue.c21
2 files changed, 4 insertions, 18 deletions
diff --git a/sys/vm/vm.h b/sys/vm/vm.h
index bfb4a60..d87495d 100644
--- a/sys/vm/vm.h
+++ b/sys/vm/vm.h
@@ -147,6 +147,7 @@ int swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred);
void swap_reserve_force(vm_ooffset_t incr);
void swap_release(vm_ooffset_t decr);
void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred);
+void swapper(void);
#endif /* VM_H */
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 6183518..948e2b3 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -96,16 +96,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_pager.h>
#include <vm/swap_pager.h>
-/*
- * System initialization
- *
- * THIS MUST BE THE LAST INITIALIZATION ITEM!!!
- *
- * Note: run scheduling should be divorced from the vm system.
- */
-static void scheduler(void *);
-SYSINIT(scheduler, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, scheduler, NULL);
-
#ifndef NO_SWAPPING
static int swapout(struct proc *);
static void swapclear(struct proc *);
@@ -695,10 +685,8 @@ faultin(p)
*
* Giant is held on entry.
*/
-/* ARGSUSED*/
-static void
-scheduler(dummy)
- void *dummy;
+void
+swapper(void)
{
struct proc *p;
struct thread *td;
@@ -708,9 +696,6 @@ scheduler(dummy)
int ppri;
int pri;
- mtx_assert(&Giant, MA_OWNED | MA_NOTRECURSED);
- mtx_unlock(&Giant);
-
loop:
if (vm_page_count_min()) {
VM_WAIT;
@@ -761,7 +746,7 @@ loop:
* Nothing to do, back to sleep.
*/
if ((p = pp) == NULL) {
- tsleep(&proc0, PVM, "sched", MAXSLP * hz / 2);
+ tsleep(&proc0, PVM, "swapin", MAXSLP * hz / 2);
goto loop;
}
PROC_LOCK(p);
OpenPOWER on IntegriCloud