From owner-freebsd-current@FreeBSD.ORG Fri Feb 1 17:17:06 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1099D12F; Fri, 1 Feb 2013 17:17:06 +0000 (UTC) (envelope-from alc@rice.edu) Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by mx1.freebsd.org (Postfix) with ESMTP id B883326D; Fri, 1 Feb 2013 17:17:05 +0000 (UTC) Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 84E6650011D; Fri, 1 Feb 2013 11:09:54 -0600 (CST) Received: from mh2.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh2.mail.rice.edu (Postfix) with ESMTP id 8203B500116; Fri, 1 Feb 2013 11:09:54 -0600 (CST) X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from mh2.mail.rice.edu ([127.0.0.1]) by mh2.mail.rice.edu (mh2.mail.rice.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id DI8VZTOp-Y8K; Fri, 1 Feb 2013 11:09:54 -0600 (CST) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id EC584500108; Fri, 1 Feb 2013 11:09:53 -0600 (CST) Message-ID: <510BF6E0.8070007@rice.edu> Date: Fri, 01 Feb 2013 11:09:52 -0600 From: Alan Cox User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/20130127 Thunderbird/17.0.2 MIME-Version: 1.0 To: Andre Oppermann Subject: Re: Cleanup and untangling of kernel VM initialization References: <510BC24D.2090406@freebsd.org> In-Reply-To: <510BC24D.2090406@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: alc@freebsd.org, freebsd-current@freebsd.org, kib@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 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: Fri, 01 Feb 2013 17:17:06 -0000 On 02/01/2013 07:25, Andre Oppermann wrote: > As an outcome of the recent problems with auto-sizing and auto-tuning of > the various kernel subsystems and related memory structures I've taken a > closer look at the whole KVM inner working and initialization process. > > I've found the VM and KVM initialization to be somewhat obscure and stuck > half-way between the old 4.4BSD way and our modern SYSINIT concept. > > While trying to understand all the steps I started to move things around, > into their own units and converted them to use SYSINITs. The result is > a patch that cleans up the majority of initialization process, removes > bitrot and moves it into the modern world order: > > http://people.freebsd.org/~andre/kernel_init_mem-20130201.diff > > The changes in particular are: > > Move large parts of vm/vm_init.c to SYSINIT()s and de-magic old-style > kernel vm initialization. > > Move vm_ksubmap_init(), bufinit() and vm_pager_bufferinit() from > machdep.c > to SYSINIT's. It was duplicated among all architectures which means > that > is wasn't architecture specific. > > Centralize definition of virtual_avail and virtual_end from the > architectures > pmap.h to vm_extern.h. > I think vm/pmap.h would be more appropriate place than vm/vm_extern.h. These variables have only been used for communication between the pmap and the machine-independent layer at initialization time. > Move various initializations from kern/subr_param.c to where it is > actually > used and SYSINIT() in particular vm_pager (pager_map / nswbuf), vm_kern > (kernel_map), swap_pager (maxswzone), sys_pipe (pipe_map / maxpipekva), > vfs_bio (buffer_map / nbuf), kern_exec (exec_map / exec_map_entries), > kern_malloc (kmem_map), kern_timeout (callwheel, ncallout). > > Move subsystem initializations from init_main.c to SYSINIT()s. > > Add sysctl's to give detailed information on all kernel vm_maps and > sub maps > > Remove unused struct kva_md_info. > It is used by assertions that block people from writing code that uses the wrong pmap functions for mapping pages into the buffer and pager maps. > Rebase auto-sizing of limits on the available KVM/kmem_map instead of > physical > memory. Depending on the kernel and architecture configuration these > two can > be very different. > > Comments and reviews appreciated. > I would really like to see the issues with the current auto-sizing code addressed before any of the stylistic changes or en-masse conversions to SYSINIT()s are considered. In particular, can we please start with the patch that moves the pipe_map initialization? After that, I think that we should revisit tunable_mbinit() and "maxmbufmem". > For committing it'll be broken into meaningful and functional pieces > with an > appropriate commit message each. > > I've tested on amd64. Feedback from other architectures welcome. > Especially > for powerpc where I had to modify the minidump routine slighly to > avoid dumping > of buffer_map memory. >