From owner-cvs-src-old@FreeBSD.ORG Tue Sep 1 11:42:46 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED4861065672 for ; Tue, 1 Sep 2009 11:42:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BF4688FC26 for ; Tue, 1 Sep 2009 11:42:46 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n81BgkXI064188 for ; Tue, 1 Sep 2009 11:42:46 GMT (envelope-from kib@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n81BgkJD064187 for cvs-src-old@freebsd.org; Tue, 1 Sep 2009 11:42:46 GMT (envelope-from kib@repoman.freebsd.org) Message-Id: <200909011142.n81BgkJD064187@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to kib@repoman.freebsd.org using -f From: Konstantin Belousov Date: Tue, 1 Sep 2009 11:41:51 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/arm/arm vm_machdep.c src/sys/kern kern_fork.c kern_kthread.c kern_proc.c kern_thr.c kern_thread.c src/sys/sys proc.h src/sys/vm vm_extern.h vm_glue.c X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2009 11:42:47 -0000 kib 2009-09-01 11:41:51 UTC FreeBSD src repository Modified files: sys/arm/arm vm_machdep.c sys/kern kern_fork.c kern_kthread.c kern_proc.c kern_thr.c kern_thread.c sys/sys proc.h sys/vm vm_extern.h vm_glue.c Log: SVN rev 196730 on 2009-09-01 11:41:51Z by kib Reintroduce the r196640, after fixing the problem with my testing. Remove the altkstacks, instead instantiate threads with kernel stack allocated with the right size from the start. For the thread that has kernel stack cached, verify that requested stack size is equial to the actual, and reallocate the stack if sizes differ [1]. This fixes the bug introduced by r173361 that was committed several days after r173004 and consisted of kthread_add(9) ignoring the non-default kernel stack size. Also, r173361 removed the caching of the kernel stacks for a non-first thread in the process. Introduce separate kernel stack cache that keeps some limited amount of preallocated kernel stacks to lower the latency of thread allocation. Add vm_lowmem handler to prune the cache on low memory condition. This way, system with reasonable amount of the threads get lower latency of thread creation, while still not exhausting significant portion of KVA for unused kstacks. Submitted by: peter [1] Discussed with: jhb, julian, peter Reviewed by: jhb Tested by: pho (and retested according to new test scenarious) MFC after: 1 week Revision Changes Path 1.43 +0 -3 src/sys/arm/arm/vm_machdep.c 1.310 +15 -10 src/sys/kern/kern_fork.c 1.50 +1 -4 src/sys/kern/kern_kthread.c 1.288 +0 -10 src/sys/kern/kern_proc.c 1.78 +1 -1 src/sys/kern/kern_thr.c 1.288 +13 -4 src/sys/kern/kern_thread.c 1.538 +2 -4 src/sys/sys/proc.h 1.89 +0 -2 src/sys/vm/vm_extern.h 1.238 +95 -43 src/sys/vm/vm_glue.c