diff options
author | jeff <jeff@FreeBSD.org> | 2008-03-10 03:16:51 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-03-10 03:16:51 +0000 |
commit | aa3cc14d3dd3ac17e34bc6285870928208e15fb4 (patch) | |
tree | 2b937253303819d1e5a6ff4ef53e6bd8cd4facb8 /sys/kern/kern_synch.c | |
parent | 14a6f96adb1d8d986d57dc89ec41c7040211f194 (diff) | |
download | FreeBSD-src-aa3cc14d3dd3ac17e34bc6285870928208e15fb4.zip FreeBSD-src-aa3cc14d3dd3ac17e34bc6285870928208e15fb4.tar.gz |
- Handle kdb switch panics outside of mi_switch() to remove some instructions
from the common path and make the code more clear. Whether this has any
impact on performance may depend on optimization levels.
Sponsored by: Nokia
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index ad13c2b..983d5a6 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -365,6 +365,15 @@ wakeup_one(ident) sleepq_release(ident); } +static void +kdb_switch(void) +{ + thread_unlock(curthread); + kdb_backtrace(); + kdb_reenter(); + panic("%s: did not reenter debugger", __func__); +} + /* * The machine independent parts of context switching. */ @@ -394,12 +403,8 @@ mi_switch(int flags, struct thread *newtd) /* * Don't perform context switches from the debugger. */ - if (kdb_active) { - thread_unlock(td); - kdb_backtrace(); - kdb_reenter(); - panic("%s: did not reenter debugger", __func__); - } + if (kdb_active) + kdb_switch(); if (flags & SW_VOL) td->td_ru.ru_nvcsw++; else |