From owner-freebsd-smp Fri Apr 27 12:47:52 2001 Delivered-To: freebsd-smp@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 668E937B629; Fri, 27 Apr 2001 12:47:44 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f3RJlil06287; Fri, 27 Apr 2001 12:47:44 -0700 (PDT) Date: Fri, 27 Apr 2001 12:47:43 -0700 From: Alfred Perlstein To: Matt Dillon Cc: smp@FreeBSD.ORG, jhb@FreeBSD.ORG Subject: Re: that vm diff now makes it into single user mode. Message-ID: <20010427124743.E18676@fw.wintelcom.net> References: <20010427042619.W18676@fw.wintelcom.net> <200104271757.f3RHvDW09866@earth.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200104271757.f3RHvDW09866@earth.backplane.com>; from dillon@earth.backplane.com on Fri, Apr 27, 2001 at 10:57:13AM -0700 X-all-your-base: are belong to us. Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Matt Dillon [010427 10:57] wrote: > > There are about fifty thousand places where the VM system assumes a > contextual lock. Basically what it comes down to is: > > * VM Pages cannot be busied from an interrupt, but can be unbusied > > * VM Objects cannot be manipulated from an interrupt > > * Mainline kernel code assumes type-stability for VM pages (easy) > > * Mainline kernel code assumes that if it looks a VM page up and the > page is not busy, that it can busy it without any locking (since > interrupts cannot busy new pages, only unbusy them). > > * Mainline kernel code assumes that it can manipulate VM objects without > any locking if it does not block. > > The only place where we have 'real' locking in regards to supporting SMP > under -stable are VM maps. i.e. the vm_map_lock() stuff existed in > -stable originally to help out with kmap locking (since interrupts could > manipulate kmap's), and was extended to support SMP in -stable due to > the fact that VM maps could be shared amoungst rforked processes. > > Unfortunately, there is no yardstick to determine where you need VM > locking -- the splvm() stuff in stable is only there for interrupt > interlocks, not for process<->process interlocks, so you can't simply > put a mutex in where splvm() was before. > > Under -current you are going to have to wind up using what will > effectively be a giant lock for the VM system. I recommend starting > with that and making sure you have a stable -current system, then > you can start moving the locks inward. I do not recommend trying to > immediately implement a mutex on major VM structures (like VM objects)... > you are almost guarenteed to create dozens of deadlock situations. Make > it work first, then start implementing the finer-grained locks. Yes, this is what I was going for, the points you made above really clarify a lot of things, I had the general idea that this is how things worked but wasn't sure about several more points, perhaps you have the time to answer: When do vm related changes propogate to struct buf? Can is happen at interrupt time? Is it done when asking for access/lock to a buf? (that would be ideal) Or will I need to do locking under vfs_bio to make sure that b->b_flags and b->b_pages are in sync wrt to vm? I am going for that giant vm lock. I've also removed the atomic ops from vm_object and vm_page flags/refcounting. My guess is that this may gain us some performance, but I'll have to see, right now anything is better than giant and so far some cool stuff runs without the Giant lock: obreak getpagesize sbrk sstk mmap ovadvise munmap mprotect madvise mincore mmap mlock munlock minherit msync mlockall munlockall and.. vm_fault Using a combination of your and Doug Ambrisko's diskless stuff as well a dusty old p100 I've got a box here that boots in under 20 seconds, really makes the compile/test cycle amazingly tolerable. -- -Alfred Perlstein - [alfred@freebsd.org] http://www.egr.unlv.edu/~slumos/on-netbsd.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message