|
|
| version 1.45, 2003/12/04 00:12:40 | version 1.46, 2003/12/04 20:09:33 |
|---|---|
| Line 78 | Line 78 |
| #include <libcaps/globaldata.h> | #include <libcaps/globaldata.h> |
| #include <sys/thread2.h> | #include <sys/thread2.h> |
| #include <sys/msgport2.h> | #include <sys/msgport2.h> |
| #include <stdio.h> | |
| #include <stdlib.h> | #include <stdlib.h> |
| #include <string.h> | |
| #include <machine/cpufunc.h> | #include <machine/cpufunc.h> |
| #include <machine/lock.h> | |
| #endif | #endif |
| Line 91 static __int64_t switch_count = 0; | Line 94 static __int64_t switch_count = 0; |
| static __int64_t preempt_hit = 0; | static __int64_t preempt_hit = 0; |
| static __int64_t preempt_miss = 0; | static __int64_t preempt_miss = 0; |
| static __int64_t preempt_weird = 0; | static __int64_t preempt_weird = 0; |
| #ifdef SMP | |
| static __int64_t ipiq_count = 0; | static __int64_t ipiq_count = 0; |
| static __int64_t ipiq_fifofull = 0; | static __int64_t ipiq_fifofull = 0; |
| #endif | |
| #ifdef _KERNEL | #ifdef _KERNEL |
| Line 104 SYSCTL_QUAD(_lwkt, OID_AUTO, switch_coun | Line 109 SYSCTL_QUAD(_lwkt, OID_AUTO, switch_coun |
| SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_hit, CTLFLAG_RW, &preempt_hit, 0, ""); | SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_hit, CTLFLAG_RW, &preempt_hit, 0, ""); |
| SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_miss, CTLFLAG_RW, &preempt_miss, 0, ""); | SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_miss, CTLFLAG_RW, &preempt_miss, 0, ""); |
| SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_weird, CTLFLAG_RW, &preempt_weird, 0, ""); | SYSCTL_QUAD(_lwkt, OID_AUTO, preempt_weird, CTLFLAG_RW, &preempt_weird, 0, ""); |
| #ifdef SMP | |
| SYSCTL_QUAD(_lwkt, OID_AUTO, ipiq_count, CTLFLAG_RW, &ipiq_count, 0, ""); | SYSCTL_QUAD(_lwkt, OID_AUTO, ipiq_count, CTLFLAG_RW, &ipiq_count, 0, ""); |
| SYSCTL_QUAD(_lwkt, OID_AUTO, ipiq_fifofull, CTLFLAG_RW, &ipiq_fifofull, 0, ""); | SYSCTL_QUAD(_lwkt, OID_AUTO, ipiq_fifofull, CTLFLAG_RW, &ipiq_fifofull, 0, ""); |
| #endif | |
| #endif | #endif |
| Line 153 _lwkt_wantresched(thread_t ntd, thread_t | Line 160 _lwkt_wantresched(thread_t ntd, thread_t |
| return((ntd->td_pri & TDPRI_MASK) > (cur->td_pri & TDPRI_MASK)); | return((ntd->td_pri & TDPRI_MASK) > (cur->td_pri & TDPRI_MASK)); |
| } | } |
| /* lwkt_gdinit() has a userland override */ | |
| #ifdef _KERNEL | #ifdef _KERNEL |
| /* | /* |
| Line 236 lwkt_alloc_thread(struct thread *td, int | Line 242 lwkt_alloc_thread(struct thread *td, int |
| return(td); | return(td); |
| } | } |
| #ifdef _KERNEL | |
| /* | /* |
| * Initialize a preexisting thread structure. This function is used by | * Initialize a preexisting thread structure. This function is used by |
| * lwkt_alloc_thread() and also used to initialize the per-cpu idlethread. | * lwkt_alloc_thread() and also used to initialize the per-cpu idlethread. |
| Line 258 lwkt_init_thread_remote(void *arg) | Line 266 lwkt_init_thread_remote(void *arg) |
| TAILQ_INSERT_TAIL(&td->td_gd->gd_tdallq, td, td_allq); | TAILQ_INSERT_TAIL(&td->td_gd->gd_tdallq, td, td_allq); |
| } | } |
| /* lwkt_init_thread has a userland override */ | |
| #ifdef _KERNEL | |
| void | void |
| lwkt_init_thread(thread_t td, void *stack, int flags, struct globaldata *gd) | lwkt_init_thread(thread_t td, void *stack, int flags, struct globaldata *gd) |
| { | { |
| Line 1263 lwkt_create(void (*func)(void *), void * | Line 1268 lwkt_create(void (*func)(void *), void * |
| td = lwkt_alloc_thread(template, cpu); | td = lwkt_alloc_thread(template, cpu); |
| if (tdp) | if (tdp) |
| *tdp = td; | *tdp = td; |
| cpu_set_thread_handler(td, kthread_exit, func, arg); | cpu_set_thread_handler(td, lwkt_exit, func, arg); |
| td->td_flags |= TDF_VERBOSE | tdflags; | td->td_flags |= TDF_VERBOSE | tdflags; |
| #ifdef SMP | #ifdef SMP |
| td->td_mpcount = 1; | td->td_mpcount = 1; |
| Line 1287 lwkt_create(void (*func)(void *), void * | Line 1292 lwkt_create(void (*func)(void *), void * |
| } | } |
| /* | /* |
| * lwkt_exit() has a userland override. | |
| * kthread_* is specific to the kernel and is not needed by userland. | * kthread_* is specific to the kernel and is not needed by userland. |
| */ | */ |
| #ifdef _KERNEL | #ifdef _KERNEL |