On Fri, Jul 13, 2001 at 10:11:07AM -0400, Leo Bicknell wrote:
> c - Prevent MBUF exhaustion.  Today, when you run out of MBUF's, bad
>     things start to happen.  It would be nice to prevent that from
>     happening, and also to provide sysadmins some warning when it is
>     about to happen.

So I dug through some code, and this really seems to only be in one
place (which surprises me a bit).

In uipc_socket.c, line 525 there's a call like this:

                space = sbspace(&so->so_snd);
 
To get the free space available, which is then used to determine if
the process should be blocked or not.

In uipc_mbuf.c, there is a global structure, "mbstat" that seems to
keep the information we need.  Modulo making the variables available,
what it seems is needed is right after the call above:

                if (mbstat.clfree < (0.1 * mbstat.clusters)) {
                    size = 0;
                }

Of course you would want to do this with all integer math, and the
right interface to get at those variables is needed.  But it seems
that would block senders before the system runs out of clusters,
allowing things to drain and keeping clusters free for receivers.
Adding in a 'printf("Low on mbuf's.")' type message would of course
be good as well.

Is it really this easy, or have I just missed the boat?

-- 
Leo Bicknell - [EMAIL PROTECTED]
Systems Engineer - Internetworking Engineer - CCIE 3440
Read TMBG List - [EMAIL PROTECTED], www.tmbg.org

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to