diff options
author | jhb <jhb@FreeBSD.org> | 2002-06-04 22:36:24 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-06-04 22:36:24 +0000 |
commit | 4a77bedabf6731896b8a132442eb4d7c4ce6a942 (patch) | |
tree | 82756c44f224c4711229691f6b3ed05de4f8b5b4 /sys/kern | |
parent | 656c10dac5dc4a2405fafdc4a4cec7a2178089e1 (diff) | |
download | FreeBSD-src-4a77bedabf6731896b8a132442eb4d7c4ce6a942.zip FreeBSD-src-4a77bedabf6731896b8a132442eb4d7c4ce6a942.tar.gz |
Replace thread_runnable() with thread_running() as the latter is more
accurate.
Suggested by: julian
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_mutex.c | 11 | ||||
-rw-r--r-- | sys/kern/subr_turnstile.c | 11 |
2 files changed, 10 insertions, 12 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index d0fc8c9..08bca8d 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -70,7 +70,8 @@ #define mtx_owner(m) (mtx_unowned((m)) ? NULL \ : (struct thread *)((m)->mtx_lock & MTX_FLAGMASK)) -#define thread_runnable(td) \ +/* XXXKSE This test will change. */ +#define thread_running(td) \ ((td)->td_kse != NULL && (td)->td_kse->ke_oncpu != NOCPU) /* @@ -131,8 +132,7 @@ propagate_priority(struct thread *td) /* * If lock holder is actually running, just bump priority. */ - /* XXXKSE this test is not sufficient */ - if (thread_runnable(td)) { + if (thread_running(td)) { MPASS(td->td_proc->p_stat == SRUN || td->td_proc->p_stat == SZOMB || td->td_proc->p_stat == SSTOP); @@ -534,10 +534,9 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) * CPU, spin instead of blocking. */ owner = (struct thread *)(v & MTX_FLAGMASK); - if (m != &Giant && thread_runnable(owner)) { + if (m != &Giant && thread_running(owner)) { mtx_unlock_spin(&sched_lock); - while (mtx_owner(m) == owner && - thread_runnable(owner)) { + while (mtx_owner(m) == owner && thread_running(owner)) { #ifdef __i386__ ia32_pause(); #endif diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index d0fc8c9..08bca8d 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -70,7 +70,8 @@ #define mtx_owner(m) (mtx_unowned((m)) ? NULL \ : (struct thread *)((m)->mtx_lock & MTX_FLAGMASK)) -#define thread_runnable(td) \ +/* XXXKSE This test will change. */ +#define thread_running(td) \ ((td)->td_kse != NULL && (td)->td_kse->ke_oncpu != NOCPU) /* @@ -131,8 +132,7 @@ propagate_priority(struct thread *td) /* * If lock holder is actually running, just bump priority. */ - /* XXXKSE this test is not sufficient */ - if (thread_runnable(td)) { + if (thread_running(td)) { MPASS(td->td_proc->p_stat == SRUN || td->td_proc->p_stat == SZOMB || td->td_proc->p_stat == SSTOP); @@ -534,10 +534,9 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) * CPU, spin instead of blocking. */ owner = (struct thread *)(v & MTX_FLAGMASK); - if (m != &Giant && thread_runnable(owner)) { + if (m != &Giant && thread_running(owner)) { mtx_unlock_spin(&sched_lock); - while (mtx_owner(m) == owner && - thread_runnable(owner)) { + while (mtx_owner(m) == owner && thread_running(owner)) { #ifdef __i386__ ia32_pause(); #endif |