From owner-freebsd-hackers Sun Jun 23 13:19:38 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id D78A937B401 for ; Sun, 23 Jun 2002 13:19:33 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 84944AE160; Sun, 23 Jun 2002 13:19:33 -0700 (PDT) Date: Sun, 23 Jun 2002 13:19:33 -0700 From: Alfred Perlstein To: Matthew Dillon Cc: freebsd-hackers@freebsd.org, Julian Elischer , Alan Cox , Tor.Egge@cvsup.no.freebsd.org Subject: Re: Bug in wakeup() (stable and current) ? Message-ID: <20020623201933.GM53232@elvis.mu.org> References: <200206232014.g5NKE5x3058562@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200206232014.g5NKE5x3058562@apollo.backplane.com> User-Agent: Mutt/1.3.27i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Matthew Dillon [020623 13:14] wrote: > This doesn't look right at all. It looks like wakeup is not restarting > properly: > > s = splhigh(); > qp = &slpque[LOOKUP(ident)]; > restart: > TAILQ_FOREACH(p, qp, p_procq) { > if (p->p_wchan == ident) { > TAILQ_REMOVE(qp, p, p_procq); > p->p_wchan = 0; > if (p->p_stat == SSLEEP) { > ... > goto restart; > } > /* XXXXXX goto restart should occur HERE XXXXXX */ > } > } > > The goto restart condition should occur one level up, as I show in > the comment. > > Could someone take a look at this and tell me if I am blowing smoke? I'm pretty sure you only need to 'goto restart' if you call into maybe_resched() as someone else may have manipulated the queues. The 'restart' label is only in there for restarting in case one of the functions called may change the lists, if we restart _every_ time we'll traverse the same procs where p->p_wchan != ident over and over needlessly. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message