Date: Wed, 26 May 2010 10:33:58 +0530 From: "C. Jayachandran" <c.jayachandran@gmail.com> To: Randall Stewart <rrs@lakerest.net>, Neel Natu <neelnatu@gmail.com>, freebsd-mips@freebsd.org Subject: Fixes to the new pagetable page allocation code. Message-ID: <AANLkTiluuD6YtgYBRj25FixyzGyrGNwQZmvB_nOeCFWN@mail.gmail.com>
index | next in thread | raw e-mail
[-- Attachment #1 --] The attached patch (also at http://people.freebsd.org/~jchandra/for-review/pmap-alloc-page-fix.diff) has two fixes for the new pagetable page allocation code, one to handle NULL return from the allocating function, and another to call VM_WAIT in cases we can wait. It also removes the variable 'req' left over from an earlier change. Please let me know if you have any comments... JC. [-- Attachment #2 --] Index: sys/mips/mips/pmap.c =================================================================== --- sys/mips/mips/pmap.c (revision 208533) +++ sys/mips/mips/pmap.c (working copy) @@ -969,10 +969,15 @@ ("pmap_ptpgzone_allocf: invalid allocation size %d", bytes)); *flags = UMA_SLAB_PRIV; - m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, - PAGE_SIZE, PAGE_SIZE); - if (m == NULL) - return (NULL); + for (;;) { + m = vm_phys_alloc_contig(1, 0, MIPS_KSEG0_LARGEST_PHYS, + PAGE_SIZE, PAGE_SIZE); + if (m != NULL) + break; + if ((wait & M_WAITOK) == 0) + return (NULL); + VM_WAIT; + } paddr = VM_PAGE_TO_PHYS(m); return ((void *)MIPS_PHYS_TO_KSEG0(paddr)); @@ -1039,8 +1044,10 @@ * allocate the page directory page */ ptdpg = pmap_alloc_pte_page(pmap, NUSERPGTBLS, M_WAITOK, &ptdva); + if (ptdpg == NULL) + return (0); + pmap->pm_segtab = (pd_entry_t *)ptdva; - pmap->pm_active = 0; pmap->pm_ptphint = NULL; for (i = 0; i < MAXCPU; i++) { @@ -1062,13 +1069,11 @@ { vm_offset_t pteva; vm_page_t m; - int req; KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT || (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK, ("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK")); - req = VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_NOOBJ; /* * Find or fabricate a new pagetable page */help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTiluuD6YtgYBRj25FixyzGyrGNwQZmvB_nOeCFWN>
