kern/46557: ipfw pipe show fails with lots of queues

Pawel Malachowski pawmal-posting at freebsd.lublin.pl
Fri Aug 13 01:20:24 PDT 2004


The following reply was made to PR kern/46557; it has been noted by GNATS.

From: Pawel Malachowski <pawmal-posting at freebsd.lublin.pl>
To: Pawel Malachowski <pawmal-posting at freebsd.lublin.pl>
Cc: freebsd-gnats-submit at 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


More information about the freebsd-ipfw mailing list