Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2004 08:20:23 GMT
From:      Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To:        ipfw@FreeBSD.org
Subject:   Re: kern/46557: ipfw pipe show fails with lots of queues
Message-ID:  <200408130820.i7D8KN21062944@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/46557; it has been noted by GNATS.

From: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
To: Pawel Malachowski <pawmal-posting@freebsd.lublin.pl>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/46557: ipfw pipe show fails with lots of queues
Date: Fri, 13 Aug 2004 10:13:35 +0200

 On Thu, Aug 12, 2004 at 07:30:25PM +0000, Pawel Malachowski wrote:
 
 >  Here are more details what is going on. I hope someone will look at this and
 >  explain why malloc() can fail here and what can be done to prevent this.
 
 Well, I will explain myself. First, a patch:
 
 *** ip_dummynet.c.orig  Fri Aug 13 09:51:54 2004
 --- ip_dummynet.c       Fri Aug 13 09:52:23 2004
 ***************
 *** 1833,1839 ****
       for (set = all_flow_sets ; set ; set = set->next )
         size += sizeof ( *set ) +
             set->rq_elements * sizeof(struct dn_flow_queue);
 !     buf = malloc(size, M_TEMP, M_NOWAIT);
       if (buf == 0) {
         splx(s);
         return ENOBUFS ;
 --- 1833,1839 ----
       for (set = all_flow_sets ; set ; set = set->next )
         size += sizeof ( *set ) +
             set->rq_elements * sizeof(struct dn_flow_queue);
 !     buf = malloc(size, M_TEMP, M_WAITOK);
       if (buf == 0) {
         splx(s);
         return ENOBUFS ;
 
 Since buf can be very big (on my system, up to 3MB), malloc typically
 consumes only 128k-512k buckets (as checked in vmstat -m). On heavy
 loaded system with huge number of pipes, there is a risk that first-fit
 strategy won't find memory because of fragmentation.
 We will change M_NOWAIT to M_WAITOK flag so malloc() will always succeed;
 dummynet_get() is called only when superuser runs `ipfw pipe show', so
 WAITOK is not a problem for us.
 
 
 -- 
 Paweł Małachowski



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