From owner-freebsd-current Mon Apr 23 23:51:19 2001 Delivered-To: freebsd-current@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3D97B37B424; Mon, 23 Apr 2001 23:51:16 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f3O6pAs24467; Mon, 23 Apr 2001 23:51:10 -0700 (PDT) Date: Mon, 23 Apr 2001 23:51:10 -0700 From: Alfred Perlstein To: Rik van Riel Cc: current@FreeBSD.ORG, jhb@FreeBSD.ORG, jake@FreeBSD.ORG Subject: Re: vm_mtx Message-ID: <20010423235110.F1790@fw.wintelcom.net> References: <20010423215131.D1790@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from riel@conectiva.com.br on Tue, Apr 24, 2001 at 03:26:48AM -0300 X-all-your-base: are belong to us. Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Rik van Riel [010423 23:27] wrote: > On Mon, 23 Apr 2001, Alfred Perlstein wrote: > > > requires vm_page_queues_mtx: > > manipulation of vm_page_queues > > [snip] > > > pmaps spotted: > > pmap_copy_page > > pmap_page_protect > > There is potential for nasty lock ordering conflicts here. > > Page faults will go vm_mtx -> vm_page_queues_mtx > The pageout code goes vm_page_queues_mtx -> vm_mtx Actually vm_page_queues_mtx == vm_mtx. At a later date I may look at finegraining the vm_mtx down a bit, as it stands there was a lot of code that manipulates flags inside of vm_pages and vm_objects by using atomic ops. Obviously this works ok when there's only one consumer but it's really expensive to do so and would probably do a lot better under a single mutex. > Alternatively, the pageout code is all under the vm_mtx, > during the whole duration, but that would lock out the > other CPUs during a potentially long time. > > It would also mean the kernel needs to have 2 versions > of all the pmap functions ... one where the vm_mtx is > already taken and one that needs to take the vm_mtx by > itself (the alternative, fixing all the callers, is > probably worse). Fixing callers makes more sense from a performance standpoint, basically there's probably signifigant amounts of code that expects the vm not to change out from under it in between calls into the vm. > > An alternative could be to use trylock functions and > let the pageout code back off whenever somebody is in > a page fault. This will work because eventually all the > page faulters will be waiting for free memory and none > of them has any of the VM locks... Well right now we're SOL on all sides, but honestly with it all still under Giant the performance is OK, if we're able to lock down a major subsystem we can only expect performance to get better. Anyhow, at this point i'm more interested in people stepping up with diffs rather than discussing my current broken ones. :) -- -Alfred Perlstein - [alfred@freebsd.org] Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message