From owner-freebsd-hackers Sun Jun 23 13:33: 4 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 4D85937B40A for ; Sun, 23 Jun 2002 13:32:36 -0700 (PDT) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.3/8.12.3) with ESMTP id g5NKWVCV063484; Sun, 23 Jun 2002 13:32:31 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.3/8.12.3/Submit) id g5NKWVZW063483; Sun, 23 Jun 2002 13:32:31 -0700 (PDT) (envelope-from dillon) Date: Sun, 23 Jun 2002 13:32:31 -0700 (PDT) From: Matthew Dillon Message-Id: <200206232032.g5NKWVZW063483@apollo.backplane.com> To: Alfred Perlstein Cc: freebsd-hackers@FreeBSD.ORG, Julian Elischer , Alan Cox , Tor.Egge@cvsup.no.freebsd.org Subject: Re: Bug in wakeup() (stable and current) ? References: <200206232014.g5NKE5x3058562@apollo.backplane.com> <20020623201933.GM53232@elvis.mu.org> 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 :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 Look at the code carefully. It's *removing* the element from the list, the conditionally restarting rather then removing the element from the list and unconditionally restarting. The only reason it works at all is because sys/queue.h does not clear out the pointers in the node that was just removed. The code is just plain wrong, though, because the queue mechanisms make no such (documented) guarentee. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message