From owner-svn-src-user@FreeBSD.ORG Mon Jun 8 09:22:57 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01D65106564A; Mon, 8 Jun 2009 09:22:57 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E522B8FC0A; Mon, 8 Jun 2009 09:22:56 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n589MuhI022145; Mon, 8 Jun 2009 09:22:56 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n589MuOc022144; Mon, 8 Jun 2009 09:22:56 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906080922.n589MuOc022144@svn.freebsd.org> From: Kip Macy Date: Mon, 8 Jun 2009 09:22:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193699 - user/kmacy/releng_7_2_fcs/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 09:22:57 -0000 Author: kmacy Date: Mon Jun 8 09:22:56 2009 New Revision: 193699 URL: http://svn.freebsd.org/changeset/base/193699 Log: try to avoid taking a cache miss on the newly allocated mbuf Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Modified: user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c ============================================================================== --- user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Mon Jun 8 09:19:25 2009 (r193698) +++ user/kmacy/releng_7_2_fcs/sys/kern/uipc_mbuf.c Mon Jun 8 09:22:56 2009 (r193699) @@ -100,6 +100,7 @@ struct mbuf * m_getm2(struct mbuf *m, int len, int how, short type, int flags) { struct mbuf *mb, *nm = NULL, *mtail = NULL; + int size; KASSERT(len >= 0, ("%s: len is < 0", __func__)); @@ -112,25 +113,30 @@ m_getm2(struct mbuf *m, int len, int how /* Loop and append maximum sized mbufs to the chain tail. */ while (len > 0) { - if (len > MCLBYTES) + if (len > MCLBYTES) { mb = m_getjcl(how, type, (flags & M_PKTHDR), MJUMPAGESIZE); - else if (len >= MINCLSIZE) + size = MJUMPAGESIZE; + } else if (len >= MINCLSIZE) { mb = m_getcl(how, type, (flags & M_PKTHDR)); - else if (flags & M_PKTHDR) + size = MCLBYTES; + } else if (flags & M_PKTHDR) { mb = m_gethdr(how, type); - else + size = MHLEN; + } else { mb = m_get(how, type); - + size = MLEN; + } /* Fail the whole operation if one mbuf can't be allocated. */ if (mb == NULL) { if (nm != NULL) m_freem(nm); return (NULL); } - + prefetch(mb); + /* Book keeping. */ - len -= mb->m_size; + len -= size; if (mtail != NULL) mtail->m_next = mb; else