Changeset View
Standalone View
sys/kern/subr_sleepqueue.c
Show First 20 Lines • Show All 848 Lines • ▼ Show 20 Lines | #endif | ||||
td->td_wmesg = NULL; | td->td_wmesg = NULL; | ||||
td->td_wchan = NULL; | td->td_wchan = NULL; | ||||
td->td_flags &= ~(TDF_SINTR | TDF_TIMEOUT); | td->td_flags &= ~(TDF_SINTR | TDF_TIMEOUT); | ||||
CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)", | CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)", | ||||
(void *)td, (long)td->td_proc->p_pid, td->td_name); | (void *)td, (long)td->td_proc->p_pid, td->td_name); | ||||
} | } | ||||
void | |||||
sleepq_remove_nested(struct thread *td) | |||||
markj: What does "nested" mean here? BTW sleepq_remove() is unused it seems. | |||||
Done Inline ActionsYou mean, 'sleepq_remove' as the possible name? Issue there is that PT_COREDUMP might select a target thread that is suspended while it is already put on sleepqueue. This is the sleepq_catch_signals()->sig_ast_needsigchk()->issignal()->ptracestop() case of ptracestop() suspension. But sv_coredump() needs to sleep for misc. VFS resources like rangelocks/vnode/buffer locks etc. So I remove the thread from the sleepq if any (resulting in the usual spurious EINTR from ptrace(2) anyway). No, I cannot select a better thread generally, this might be the only thread at all. Nested there denotes the situation of sleep while we are on sleepqueue, if not done. kib: You mean, 'sleepq_remove' as the possible name?
Issue there is that PT_COREDUMP might select a… | |||||
Done Inline ActionsYes, sleepq_remove() seems like a better name for this. I don't have a strong feeling about it though. markj: Yes, sleepq_remove() seems like a better name for this. I don't have a strong feeling about it… | |||||
Done Inline ActionsIMO sleepq_remove() is too generic, this situation is specific. I want to leave the generic name unused. kib: IMO sleepq_remove() is too generic, this situation is specific. I want to leave the generic… | |||||
{ | |||||
struct sleepqueue_chain *sc; | |||||
struct sleepqueue *sq; | |||||
const void *wchan; | |||||
MPASS(TD_ON_SLEEPQ(td)); | |||||
wchan = td->td_wchan; | |||||
sc = SC_LOOKUP(wchan); | |||||
mtx_lock_spin(&sc->sc_lock); | |||||
sq = sleepq_lookup(wchan); | |||||
MPASS(sq != NULL); | |||||
thread_lock(td); | |||||
sleepq_remove_thread(sq, td); | |||||
mtx_unlock_spin(&sc->sc_lock); | |||||
/* Returns with the thread lock owned. */ | |||||
} | |||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
/* | /* | ||||
* UMA zone item deallocator. | * UMA zone item deallocator. | ||||
*/ | */ | ||||
static void | static void | ||||
sleepq_dtor(void *mem, int size, void *arg) | sleepq_dtor(void *mem, int size, void *arg) | ||||
{ | { | ||||
struct sleepqueue *sq; | struct sleepqueue *sq; | ||||
▲ Show 20 Lines • Show All 630 Lines • Show Last 20 Lines |
What does "nested" mean here? BTW sleepq_remove() is unused it seems.