From owner-freebsd-current@FreeBSD.ORG Sat Apr 30 14:40:31 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1354D16A4CE for ; Sat, 30 Apr 2005 14:40:31 +0000 (GMT) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id C0D5543D41 for ; Sat, 30 Apr 2005 14:40:30 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with ESMTP id 35DAC46B3C for ; Sat, 30 Apr 2005 10:40:30 -0400 (EDT) Date: Sat, 30 Apr 2005 15:43:21 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: current@FreeBSD.org Message-ID: <20050430154103.L31768@fledge.watson.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Kernel memory allocator change (cvs commit: src/sys/vm uma_core.c uma_int.h (fwd) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Apr 2005 14:40:31 -0000 I've finally committed the UMA critical section per-cpu cache synchronization change to the CVS HEAD. Two notes: - This is intended to make things slightly faster. If you notice a consistent slow-down, ideally characterizable with a highly reproduceable benchmark, I'd like to hear about it. "Yes, it did get faster" is also good, as is "it didn't get slower". - We've done quite a bit of testing with these patches in place. However, that doesn't preclude a stability proble. For those running regular stability testing on HEAD, running with this change would be a good thing. Thanks, Robert N M Watson ---------- Forwarded message ---------- Date: Fri, 29 Apr 2005 18:56:36 +0000 (UTC) From: Robert Watson To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/vm uma_core.c uma_int.h rwatson 2005-04-29 18:56:36 UTC FreeBSD src repository Modified files: sys/vm uma_core.c uma_int.h Log: Modify UMA to use critical sections to protect per-CPU caches, rather than mutexes, which offers lower overhead on both UP and SMP. When allocating from or freeing to the per-cpu cache, without INVARIANTS enabled, we now no longer perform any mutex operations, which offers a 1%-3% performance improvement in a variety of micro-benchmarks. We rely on critical sections to prevent (a) preemption resulting in reentrant access to UMA on a single CPU, and (b) migration of the thread during access. In the event we need to go back to the zone for a new bucket, we release the critical section to acquire the global zone mutex, and must re-acquire the critical section and re-evaluate which cache we are accessing in case migration has occured, or circumstances have changed in the current cache. Per-CPU cache statistics are now gathered lock-free by the sysctl, which can result in small races in statistics reporting for caches. Reviewed by: bmilekic, jeff (somewhat) Tested by: rwatson, kris, gnn, scottl, mike at sentex dot net, others Revision Changes Path 1.119 +120 -103 src/sys/vm/uma_core.c 1.30 +0 -10 src/sys/vm/uma_int.h