Date: Mon, 10 May 2004 16:23:46 -0700 (PDT) From: Julian Elischer <julian@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 52646 for review Message-ID: <200405102323.i4ANNkE5031805@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=52646 Change 52646 by julian@julian_desk on 2004/05/10 16:23:03 finish IFC.. changes in parts of code that moved to a new file Affected files ... .. //depot/projects/nsched/sys/kern/kern_kse.c#5 edit Differences ... ==== //depot/projects/nsched/sys/kern/kern_kse.c#5 (text+ko) ==== @@ -327,9 +327,12 @@ PROC_LOCK(p); if (ku->ku_mflags & KMF_WAITSIGEVENT) { /* UTS wants to wait for signal event */ - if (!(p->p_flag & P_SIGEVENT) && !(ku->ku_flags & KUF_DOUPCALL)) + if (!(p->p_flag & P_SIGEVENT) && !(ku->ku_flags & KUF_DOUPCALL)) { + td->td_kflags |= TDK_KSERELSIG; error = msleep(&p->p_siglist, &p->p_mtx, PPAUSE|PCATCH, "ksesigwait", (uap->timeout ? tvtohz(&tv) : 0)); + td->td_kflags &= ~(TDK_KSERELSIG | TDK_WAKEUP); + } p->p_flag &= ~P_SIGEVENT; sigset = p->p_siglist; PROC_UNLOCK(p); @@ -338,9 +341,11 @@ } else { if (! kg->kg_completed && !(ku->ku_flags & KUF_DOUPCALL)) { kg->kg_upsleeps++; + td->td_kflags |= TDK_KSEREL; error = msleep(&kg->kg_completed, &p->p_mtx, PPAUSE|PCATCH, "kserel", (uap->timeout ? tvtohz(&tv) : 0)); + td->td_kflags &= ~(TDK_KSEREL | TDK_WAKEUP); kg->kg_upsleeps--; } PROC_UNLOCK(p); @@ -384,31 +389,36 @@ } else { kg = td->td_ksegrp; if (kg->kg_upsleeps) { + mtx_unlock_spin(&sched_lock); wakeup_one(&kg->kg_completed); - mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); return (0); } ku = TAILQ_FIRST(&kg->kg_upcalls); } - if (ku) { - if ((td2 = ku->ku_owner) == NULL) { - panic("%s: no owner", __func__); - } else if (TD_ON_SLEEPQ(td2) && (td2->td_flags & TDF_SINTR) && - ((td2->td_wchan == &kg->kg_completed) || - (td2->td_wchan == &p->p_siglist && - (ku->ku_mflags & KMF_WAITSIGEVENT)))) { - sleepq_abort(td2); - } else { - ku->ku_flags |= KUF_DOUPCALL; + if (ku == NULL) { + mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); + return (ESRCH); + } + if ((td2 = ku->ku_owner) == NULL) { + mtx_unlock_spin(&sched_lock); + panic("%s: no owner", __func__); + } else if (td2->td_kflags & (TDK_KSEREL | TDK_KSERELSIG)) { + mtx_unlock_spin(&sched_lock); + if (!(td2->td_kflags & TDK_WAKEUP)) { + td2->td_kflags |= TDK_WAKEUP; + if (td2->td_kflags & TDK_KSEREL) + sleepq_remove(td2, &kg->kg_completed); + else + sleepq_remove(td2, &p->p_siglist); } + } else { + ku->ku_flags |= KUF_DOUPCALL; mtx_unlock_spin(&sched_lock); - PROC_UNLOCK(p); - return (0); } - mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p); - return (ESRCH); + return (0); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405102323.i4ANNkE5031805>