diff options
author | avg <avg@FreeBSD.org> | 2013-07-24 09:45:31 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2013-07-24 09:45:31 +0000 |
commit | 9e6374b6a9ee35bc4eb4e1d73c4942b4b2391e57 (patch) | |
tree | 86485591661a4e2aaffdc78caab463f4b4f101f9 /sys/kern/init_main.c | |
parent | 0a4136d3530f88ddcec3af09ad403f557fba393b (diff) | |
download | FreeBSD-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/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 5d5346e..1eb3647 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -243,9 +243,6 @@ restart: /* * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. - * - * The last item on the list is expected to be the scheduler, - * which will not return. */ for (sipp = sysinit; sipp < sysinit_end; sipp++) { @@ -303,7 +300,13 @@ restart: } } - panic("Shouldn't get here!"); + mtx_assert(&Giant, MA_OWNED | MA_NOTRECURSED); + mtx_unlock(&Giant); + + /* + * Now hand over this thread to swapper. + */ + swapper(); /* NOTREACHED*/ } @@ -346,7 +349,7 @@ static char wit_warn[] = "WARNING: WITNESS option enabled, expect reduced performance.\n"; SYSINIT(witwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 1, print_caddr_t, wit_warn); -SYSINIT(witwarn2, SI_SUB_RUN_SCHEDULER, SI_ORDER_THIRD + 1, +SYSINIT(witwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1, print_caddr_t, wit_warn); #endif @@ -355,7 +358,7 @@ static char diag_warn[] = "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n"; SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_THIRD + 2, print_caddr_t, diag_warn); -SYSINIT(diagwarn2, SI_SUB_RUN_SCHEDULER, SI_ORDER_THIRD + 2, +SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 2, print_caddr_t, diag_warn); #endif |