From owner-cvs-all@FreeBSD.ORG Thu Mar 27 15:33:58 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 379B837B405 for ; Thu, 27 Mar 2003 15:33:58 -0800 (PST) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id D320243FB1 for ; Thu, 27 Mar 2003 15:33:56 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.3/8.12.3) with ESMTP id h2RNXqAq066578; Thu, 27 Mar 2003 15:33:52 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.3/8.12.3/Submit) id h2RNXqwf066577; Thu, 27 Mar 2003 15:33:52 -0800 (PST) (envelope-from rizzo) Date: Thu, 27 Mar 2003 15:33:52 -0800 From: Luigi Rizzo To: Sam Leffler Message-ID: <20030327153352.A66323@xorpc.icir.org> References: <200303260452.h2Q4quap015364@www.ambrisko.com> <20030326114030.U2075@odysseus.silby.com> <20030326183351.GJ57674@elvis.mu.org> <20030326130903.G2075@odysseus.silby.com> <20030327013224.P7674@odysseus.silby.com> <031301c2f49b$09d2bfb0$52557f42@errno.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <031301c2f49b$09d2bfb0$52557f42@errno.com>; from sam@errno.com on Thu, Mar 27, 2003 at 11:56:47AM -0800 X-Spam-Status: No, hits=-30.4 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,IN_REP_TO,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MUTT version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: src-committers@FreeBSD.org cc: Doug Ambrisko cc: Maxime Henrion cc: cvs-src@FreeBSD.org cc: Mike Silbersack cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/conf options src/sys/netinet ip_output.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2003 23:33:59 -0000 [about coalescing long chains of mbufs...] On Thu, Mar 27, 2003 at 11:56:47AM -0800, Sam Leffler wrote: [have read the rest of the thread too] > I thought about this some more. If the purpose of m_defrag* is to handle ... > driver unless you make a second pass. Given that this problem should happen > infrequently and that you're just trying to avoid discarding the packet I > think you're best off doing a best effort job where you coalesce only mbufs > and leave clusters/ext's alone. Then if the subsequent bus_dma_load_mbuf > call fails you discard the packet. Other than the read/write requirements the problem is that the code path leading to these situation behave sistematically like this -- ie. you are likely to keep dropping the packet again and again, so dropping may not be an option. Anyways, one path where this came out was tcp_usr_send() --> sbappend() --> sbcompress() and i think if the code decides to call sbcompress(), then the latter should try and do its job as good as it can, including allocating a cluster when the caller does a pathological number of short writes, or merging segments trying to reduce the waste factor to something reasonable E.g. note that sbcompress() does the following: while (m) { ... if (n && (n->m_flags & M_EOR) == 0 && M_WRITABLE(n) && m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */ m->m_len <= M_TRAILINGSPACE(n) && n->m_type == m->m_type) { ... do the copy and free m continue; } ... } so individual writes of 513+ bytes will result in wasting up to 75% of the socket buffer space. At the very least, i would drop the 'm->m_len <= MCLBYTES / 4' check to reduce the waste. cheers luigi