Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102102508
D41635.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41635.diff
View Options
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -3973,12 +3973,11 @@
struct spglist free;
pd_entry_t oldpde, *pde;
vm_page_t mt;
+ vm_page_t uwptpg;
rw_assert(&pvh_global_lock, RA_WLOCKED);
KASSERT((newpde & (PG_M | PG_RW)) != PG_RW,
("pmap_enter_pde: newpde is missing PG_M"));
- KASSERT(pmap == kernel_pmap || (newpde & PG_W) == 0,
- ("pmap_enter_pde: cannot create wired user mapping"));
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
pde = pmap_pde(pmap, va);
oldpde = *pde;
@@ -4028,11 +4027,40 @@
panic("pmap_enter_pde: trie insert failed");
}
}
+
+ /*
+ * Allocate a leaf ptpage for wired userspace pages.
+ */
+ uwptpg = NULL;
+ if ((newpde & PG_W) != 0 && pmap != kernel_pmap) {
+ uwptpg = vm_page_alloc_noobj(VM_ALLOC_WIRED);
+ if (uwptpg == NULL) {
+ return (KERN_RESOURCE_SHORTAGE);
+ }
+ uwptpg->pindex = va >> PDRSHIFT;
+ if (pmap_insert_pt_page(pmap, uwptpg, true, false)) {
+ vm_page_unwire_noq(uwptpg);
+ vm_page_free(uwptpg);
+ return (KERN_RESOURCE_SHORTAGE);
+ }
+ pmap->pm_stats.resident_count++;
+ uwptpg->ref_count = NPTEPG;
+ }
if ((newpde & PG_MANAGED) != 0) {
/*
* Abort this mapping if its PV entry could not be created.
*/
if (!pmap_pv_insert_pde(pmap, va, newpde, flags)) {
+ if (uwptpg != NULL) {
+ mt = pmap_remove_pt_page(pmap, va);
+ KASSERT(mt == uwptpg,
+ ("removed pt page %p, expected %p", mt,
+ uwptpg));
+ pmap->pm_stats.resident_count--;
+ uwptpg->ref_count = 1;
+ vm_page_unwire_noq(uwptpg);
+ vm_page_free(uwptpg);
+ }
CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx"
" in pmap %p", va, pmap);
return (KERN_RESOURCE_SHORTAGE);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 3:40 PM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14537739
Default Alt Text
D41635.diff (1 KB)
Attached To
Mode
D41635: i386 pmap: allocate leaf page table page for wired userspace superpages
Attached
Detach File
Event Timeline
Log In to Comment