Date: Wed, 2 Jun 2010 17:47:01 +0530 From: "C. Jayachandran" <c.jayachandran@gmail.com> To: Alan Cox <alc@cs.rice.edu> Cc: "Jayachandran C." <jchandra@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart <rrs@lakerest.net> Subject: Re: svn commit: r208589 - head/sys/mips/mips Message-ID: <AANLkTikdnvXsTwm8onl3MZPQmVfV-2GovB9--KMNnMgC@mail.gmail.com> In-Reply-To: <4C05F9BC.40409@cs.rice.edu> References: <201005271005.o4RA5eVu032269@svn.freebsd.org> <4C058145.3000707@cs.rice.edu> <AANLkTil955Ek-a3tek4Ony9NqrK5l2j7lNA4baRVPBzb@mail.gmail.com> <4C05F9BC.40409@cs.rice.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 2, 2010 at 11:57 AM, Alan Cox <alc@cs.rice.edu> wrote: > C. Jayachandran wrote: >> >> On Wed, Jun 2, 2010 at 3:23 AM, Alan Cox <alc@cs.rice.edu> wrote: >> >>> >>> On 5/27/2010 5:05 AM, Jayachandran C. wrote: >>> >>>> >>>> Author: jchandra >>>> Date: Thu May 27 10:05:40 2010 >>>> New Revision: 208589 >>>> URL: http://svn.freebsd.org/changeset/base/208589 >>>> >>>> Log: >>>> =A0Call VM_WAIT in pmap_ptpgzone_allocf() if =A0M_WAITOK is set. >>>> =A0Removed unused variable. >>>> >>>> =A0Approved by: rrs (mentor) >>>> >>>> >>>> >>> >>> I'm afraid that this will work some of the time, but not all of the tim= e. >>> =A0Specifically, there is no guarantee that any of the available free (= or >>> cached) pages after the VM_WAIT will fall within the range of suitable >>> physical addresses. =A0Moreover, and perhaps most worrisome, is that th= is >>> function could do a lot of spinning. =A0Every time this function sleeps= and >>> a >>> single page is freed (or cached) by someone else, this function will be >>> reawakened. =A0With a little bad luck, you could spin indefinitely. >>> >>> For essentially this reason, contigmalloc(), kmem_alloc_contig(), and >>> kmem_alloc_attr() don't use VM_WAIT, but instead a function called >>> vm_contig_grow_cache(). >>> >> >> I had seen the vm_contig_grow_cache() usage, but could not use it as >> it was defined as a static function. >> >> I did not want to use contigmalloc()/kmem_alloc_contig() either, >> because the pages in that memory region are already direct mapped and >> setting up another mapping is not necessary. The overall idea is to >> allocate pages in the direct mapped region for the page table entries >> so that we don't take a TLB exception while accessing page tables >> (which is costly as MIPS has a software TLB exception handler). >> >> Can you suggest the right way to do this? I will make the changes and >> send a patch for approval. >> > > I would encourage you to make vm_contig_grow_cache() an extern function a= nd > use it. =A0(vm/vm_pageout.h is probably the best place for the function > prototype.) I'll create a patch for this and related changes in mips/mips/pmap.c > If you're interested in taking this a small step further, it would make > sense to add two parameters to vm_contig_grow_cache() and > vm_contig_launder(): a "low" and a "high" physical address. > =A0vm_contig_launder() could then skip pages that are outside the desired > range. I am looking at this now, part of the logic which vm_phys_alloc_contig() uses to check pages address should work here. Will send out changes for this, if it works out. Thanks, JC.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikdnvXsTwm8onl3MZPQmVfV-2GovB9--KMNnMgC>