Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Allocate buffers with (M_WAITOK | M_CANFAIL) instead...



details:   https://anonhg.NetBSD.org/src/rev/37eb90efcc50
branches:  trunk
changeset: 763679:37eb90efcc50
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Mar 30 18:04:27 2011 +0000

description:
Allocate buffers with (M_WAITOK | M_CANFAIL) instead of M_NOWAIT.
M_NOWAIT cause dhcpd on a low-memory server with lots of interfaces to
occasionally fail to start with ENOBUFS; (M_WAITOK | M_CANFAIL) seems to
fix this.
Tested on 3 different dhcp servers.

diffstat:

 sys/net/bpf.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r ef2f94a4ae6e -r 37eb90efcc50 sys/net/bpf.c
--- a/sys/net/bpf.c     Wed Mar 30 17:52:45 2011 +0000
+++ b/sys/net/bpf.c     Wed Mar 30 18:04:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bpf.c,v 1.162 2011/01/22 19:12:58 christos Exp $       */
+/*     $NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $ */
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.162 2011/01/22 19:12:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1607,10 +1607,10 @@
 bpf_allocbufs(struct bpf_d *d)
 {
 
-       d->bd_fbuf = malloc(d->bd_bufsize, M_DEVBUF, M_NOWAIT);
+       d->bd_fbuf = malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK | M_CANFAIL);
        if (!d->bd_fbuf)
                return (ENOBUFS);
-       d->bd_sbuf = malloc(d->bd_bufsize, M_DEVBUF, M_NOWAIT);
+       d->bd_sbuf = malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK | M_CANFAIL);
        if (!d->bd_sbuf) {
                free(d->bd_fbuf, M_DEVBUF);
                return (ENOBUFS);



Home | Main Index | Thread Index | Old Index