From owner-cvs-all@FreeBSD.ORG Sat Jan 31 21:56:57 2004 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 5A06216A4CE; Sat, 31 Jan 2004 21:56:57 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E916243D4C; Sat, 31 Jan 2004 21:56:51 -0800 (PST) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i115up0B067723; Sat, 31 Jan 2004 21:56:51 -0800 (PST) (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i115upV7067722; Sat, 31 Jan 2004 21:56:51 -0800 (PST) (envelope-from rwatson) Message-Id: <200402010556.i115upV7067722@repoman.freebsd.org> From: Robert Watson Date: Sat, 31 Jan 2004 21:56:51 -0800 (PST) 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_mac.c sys_pipe.c src/sys/security/mac mac_pipe.c src/sys/security/mac_biba mac_biba.c src/sys/security/mac_lomac mac_lomac.c src/sys/security/mac_mls mac_mls.c src/sys/security/mac_test ... 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: Sun, 01 Feb 2004 05:56:57 -0000 rwatson 2004/01/31 21:56:51 PST FreeBSD src repository Modified files: sys/kern kern_mac.c sys_pipe.c sys/security/mac mac_pipe.c sys/security/mac_biba mac_biba.c sys/security/mac_lomac mac_lomac.c sys/security/mac_mls mac_mls.c sys/security/mac_test mac_test.c sys/sys mac.h mac_policy.h pipe.h Log: Coalesce pipe allocations and frees. Previously, the pipe code would allocate two 'struct pipe's from the pipe zone, and malloc a mutex. - Create a new "struct pipepair" object holding the two 'struct pipe' instances, struct mutex, and struct label reference. Pipe structures now have a back-pointer to the pipe pair, and a 'pipe_present' flag to indicate whether the half has been closed. - Perform mutex init/destroy in zone init/destroy, avoiding reallocating the mutex for each pipe. Perform most pipe structure setup in zone constructor. - VM memory mappings for pageable buffers are still done outside of the UMA zone. - Change MAC API to speak 'struct pipepair' instead of 'struct pipe', update many policies. MAC labels are also handled outside of the UMA zone for now. Label-only policy modules don't have to be recompiled, but if a module is recompiled, its pipe entry points will need to be updated. If a module actually reached into the pipe structures (unlikely), that would also need to be modified. These changes substantially simplify failure handling in the pipe code as there are many fewer possible failure modes. On half-close, pipes no longer free the 'struct pipe' for the closed half until a full-close takes place. However, VM mapped buffers are still released on half-close. Some code refactoring is now possible to clean up some of the back references, etc; this patch attempts not to change the structure of most of the pipe implementation, only allocation/free code paths, so as to avoid introducing bugs (hopefully). This cuts about 8%-9% off the cost of sequential pipe allocation and free in system call tests on UP and SMP in my micro-benchmarks. May or may not make a difference in macro-benchmarks, but doing less work is good. Reviewed by: juli, tjr Testing help: dwhite, fenestro, scottl, et al Revision Changes Path 1.108 +3 -3 src/sys/kern/kern_mac.c 1.165 +150 -91 src/sys/kern/sys_pipe.c 1.105 +34 -33 src/sys/security/mac/mac_pipe.c 1.74 +8 -8 src/sys/security/mac_biba/mac_biba.c 1.27 +6 -6 src/sys/security/mac_lomac/mac_lomac.c 1.61 +8 -8 src/sys/security/mac_mls/mac_mls.c 1.41 +8 -8 src/sys/security/mac_test/mac_test.c 1.54 +10 -10 src/sys/sys/mac.h 1.48 +15 -14 src/sys/sys/mac_policy.h 1.26 +14 -3 src/sys/sys/pipe.h