From owner-freebsd-current Mon May 17 15:36:53 1999 Delivered-To: freebsd-current@freebsd.org Received: from enst.enst.fr (enst.enst.fr [137.194.2.16]) by hub.freebsd.org (Postfix) with ESMTP id 8BB2C14FD4 for ; Mon, 17 May 1999 15:36:45 -0700 (PDT) (envelope-from beyssac@enst.fr) Received: from bofh.enst.fr (bofh.enst.fr [137.194.32.191]) by enst.enst.fr (8.9.1a/8.9.1) with ESMTP id AAA17319; Tue, 18 May 1999 00:36:40 +0200 (MET DST) Received: by bofh.enst.fr (Postfix, from userid 12426) id 24BE0D21A; Tue, 18 May 1999 00:36:40 +0200 (CEST) Message-ID: <19990518003640.A2978@enst.fr> Date: Tue, 18 May 1999 00:36:40 +0200 From: Pierre Beyssac To: Matthew Dillon , Garrett Wollman Cc: freebsd-current@FreeBSD.ORG Subject: Re: mbuf starvation References: <19990512172544.A440@enst.fr> <199905121656.MAA00970@khavrinen.lcs.mit.edu> <199905122034.NAA88116@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <199905122034.NAA88116@apollo.backplane.com>; from Matthew Dillon on Wed, May 12, 1999 at 01:34:05PM -0700 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, May 12, 1999 at 01:34:05PM -0700, Matthew Dillon wrote: > asleep() allows a subroutine deep in the call stack to specify an > asynchronous blocking condition and then return a temporary failure > up through the ranks. At the top level, the scheduler sees and acts > upon the asynchronous blocking condition. Higher level routines do not So if I get it right, this would give something like the code below. Is that the idea? What's missing in the asleep/await code to use them in such a way? soxxx() { for (;;) { await(&mbuf_slp); /* code */ error = xxx(&mbuf_slp); if (error != ENOBUFS) break; } } m_retry() { /* find an mbuf... */ if (/* got an mbuf to return */) return mbuf; else { asleep(&mbuf_slp); return NULL; } } m_free() { /* Free mbuf... */ wakeup(&mbuf_slp); } And, unless I'm missing something, we still need to properly check for NULL return values from m_get and friends. -- Pierre Beyssac pb@enst.fr To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message