Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 1999 00:36:40 +0200
From:      Pierre Beyssac <beyssac@enst.fr>
To:        Matthew Dillon <dillon@apollo.backplane.com>, Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: mbuf starvation
Message-ID:  <19990518003640.A2978@enst.fr>
In-Reply-To: <199905122034.NAA88116@apollo.backplane.com>; from Matthew Dillon on Wed, May 12, 1999 at 01:34:05PM -0700
References:  <19990512172544.A440@enst.fr> <199905121656.MAA00970@khavrinen.lcs.mit.edu> <199905122034.NAA88116@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990518003640.A2978>