From owner-freebsd-net@FreeBSD.ORG Fri Apr 10 20:02:44 2009 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41D42106566B for ; Fri, 10 Apr 2009 20:02:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1DAEA8FC1A for ; Fri, 10 Apr 2009 20:02:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id CFB4D46B94; Fri, 10 Apr 2009 16:02:43 -0400 (EDT) Date: Fri, 10 Apr 2009 21:02:43 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Karim Fodil-Lemelin In-Reply-To: <49DF9EAD.1050609@xiplink.com> Message-ID: References: <49DF5F75.6080607@xiplink.com> <49DF9EAD.1050609@xiplink.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-net@freebsd.org Subject: Re: m_tag, malloc vs uma X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2009 20:02:44 -0000 On Fri, 10 Apr 2009, Karim Fodil-Lemelin wrote: > Thank you for the answer, clear and concise. I asked the question because I > had modified pf_get_mtag() to use uma directly in the hope that it would be > faster then calling malloc. But since pf_mtag is 20bytes, malloc will end up > using a fixed 32bytes zone and I shouldn't expect much speed gain from using > something like (except some savings from not having to select the 32bytes > zone): There is another small overhead, the critical section used to protect the consistency of the per-CPU malloc type alloc and free counters, but it's also very small. I think it would be desirable to make a change to more flexible m_tag types for 8.0, but I'm not sure I have time to implement/test it. Is this something you might be interested in working on? I'm thinking of basically replacing the m_tag_free pointer with a pointer to a small vector of operations, possibly something along these lines: struct m_tag_ops { void (*m_tag_free)(struct m_tag *); struct m_tag (*m_tag_copy)(struct m_tag *); }; If the m_tag_ops pointer is NULL, we go with today's default (requiring minimal change of existing consumers). I'm not sure if there are any other function pointers we'd need at this point? Robert N M Watson Computer Laboratory University of Cambridge