From owner-cvs-all@FreeBSD.ORG Sat Mar 5 15:24:04 2005 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 7EAC216A4CE; Sat, 5 Mar 2005 15:24:04 +0000 (GMT) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09C0A43D41; Sat, 5 Mar 2005 15:24:04 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior-wifi.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.1/8.13.1) with ESMTP id j25FPnhD056995; Sat, 5 Mar 2005 08:25:49 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <4229CE8B.20703@samsco.org> Date: Sat, 05 Mar 2005 08:21:47 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050218 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alexey Dokuchaev References: <200503050915.j259F30c058488@repoman.freebsd.org> <20050305101211.GA59471@FreeBSD.org> In-Reply-To: <20050305101211.GA59471@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: David Xu cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys proc.h umtx.h src/sys/kernkern_thread.c kern_umtx.c 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: Sat, 05 Mar 2005 15:24:04 -0000 Alexey Dokuchaev wrote: > On Sat, Mar 05, 2005 at 09:15:03AM +0000, David Xu wrote: > >>davidxu 2005-03-05 09:15:03 UTC >> >> FreeBSD src repository >> >> Modified files: >> sys/sys proc.h umtx.h >> sys/kern kern_thread.c kern_umtx.c >> Log: >> Allocate umtx_q from heap instead of stack, this avoids >> page fault panic in kernel under heavy swapping. > > > So.. Slow malloc/free path at last. As a side note, could someone (not > necessarily David) comment on my impression that, for example, recently > reported not-so-optimal performance of our threading model(s) is largely due > to heavy use of malloc/free, as opposed to other operating systems out > there? Am I right thinking that this is main bottleneck? If malloc'ing is > so costly, why we're taking this path? Can kernel malloc() be optimized? > > Thanks. > > ./danfe All David's change does is allocate the umtx_q object at thread creation, it doesn't allocate it on every contested lock operation like was first suggested. So yes, it likely slows down thread creation by a small amount, but there is already a lot of other overhead there. Thread allocation is already optimized by UMA, and it might be possible to optmize the sub-allocations by putting them under UMA too. Scott