From owner-cvs-src@FreeBSD.ORG Thu Feb 10 22:23:03 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F1FF16A4CE; Thu, 10 Feb 2005 22:23:03 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 28D0E43D41; Thu, 10 Feb 2005 22:23:03 +0000 (GMT) (envelope-from bmilekic@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j1AMN3XQ023235; Thu, 10 Feb 2005 22:23:03 GMT (envelope-from bmilekic@repoman.freebsd.org) Received: (from bmilekic@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j1AMN3AP023234; Thu, 10 Feb 2005 22:23:03 GMT (envelope-from bmilekic) Message-Id: <200502102223.j1AMN3AP023234@repoman.freebsd.org> From: Bosko Milekic Date: Thu, 10 Feb 2005 22:23:03 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern kern_mbuf.c uipc_mbuf.c src/sys/sys mbuf.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2005 22:23:03 -0000 bmilekic 2005-02-10 22:23:03 UTC FreeBSD src repository Modified files: sys/kern kern_mbuf.c uipc_mbuf.c sys/sys mbuf.h Log: Optimize the way reference counting is performed with Mbufs. We do not need to perform an extra memory fetch in the Packet (Mbuf+Cluster) constructor to initialize the reference counter anymore. The reference counts are located in a separate memory region (in the slab header, because this zone is UMA_ZONE_REFCNT), so the memory fetch resulted very often in a cache miss. Additionally, and perhaps more significantly, optimize the free mbuf+cluster (packet) case, which is very common, to no longer require an atomic operation on free (to verify the reference counter) if the reference on the cluster has never been increased (also very common). Reduces an atomic on mbuf free on average. Original patch submitted by: Gerrit Nagelhout Revision Changes Path 1.6 +2 -4 src/sys/kern/kern_mbuf.c 1.141 +37 -21 src/sys/kern/uipc_mbuf.c 1.165 +21 -3 src/sys/sys/mbuf.h