Page MenuHomeFreeBSD

D20763.id59102.diff
No OneTemporary

D20763.id59102.diff

Index: sys/vm/vm_page.h
===================================================================
--- sys/vm/vm_page.h
+++ sys/vm/vm_page.h
@@ -410,6 +410,7 @@
* Page flags. If changed at any other time than page allocation or
* freeing, the modification must be protected by the vm_page lock.
*/
+#define PG_CACHE_ALLOC 0x0001 /* was allocated from per-CPU caches */
#define PG_FICTITIOUS 0x0004 /* physical page doesn't exist */
#define PG_ZERO 0x0008 /* page is zeroed */
#define PG_MARKER 0x0010 /* special queue marker page */
Index: sys/vm/vm_page.c
===================================================================
--- sys/vm/vm_page.c
+++ sys/vm/vm_page.c
@@ -1803,8 +1803,9 @@
if (object != NULL)
VM_OBJECT_ASSERT_WLOCKED(object);
-again:
+ flags = 0;
m = NULL;
+again:
#if VM_NRESERVLEVEL > 0
/*
* Can we allocate the page from a reservation?
@@ -1820,8 +1821,10 @@
vmd = VM_DOMAIN(domain);
if (object != NULL && vmd->vmd_pgcache != NULL) {
m = uma_zalloc(vmd->vmd_pgcache, M_NOWAIT);
- if (m != NULL)
+ if (m != NULL) {
+ flags |= PG_CACHE_ALLOC;
goto found;
+ }
}
if (vm_domain_allocate(vmd, req, 1)) {
/*
@@ -1848,22 +1851,15 @@
return (NULL);
}
- /*
- * At this point we had better have found a good page.
- */
- KASSERT(m != NULL, ("missing page"));
-
found:
vm_page_dequeue(m);
vm_page_alloc_check(m);
/*
- * Initialize the page. Only the PG_ZERO flag is inherited.
+ * Initialize the page. The PG_ZERO flag is inherited.
*/
- flags = 0;
if ((req & VM_ALLOC_ZERO) != 0)
- flags = PG_ZERO;
- flags &= m->flags;
+ flags |= (m->flags & PG_ZERO);
if ((req & VM_ALLOC_NODUMP) != 0)
flags |= PG_NODUMP;
m->flags = flags;
@@ -2009,6 +2005,7 @@
* Can we allocate the pages without the number of free pages falling
* below the lower bound for the allocation class?
*/
+ m_ret = NULL;
again:
#if VM_NRESERVLEVEL > 0
/*
@@ -2022,7 +2019,6 @@
goto found;
}
#endif
- m_ret = NULL;
vmd = VM_DOMAIN(domain);
if (vm_domain_allocate(vmd, req, npages)) {
/*
@@ -3486,7 +3482,7 @@
return;
vmd = vm_pagequeue_domain(m);
- if (m->pool == VM_FREEPOOL_DEFAULT && vmd->vmd_pgcache != NULL) {
+ if ((m->flags & PG_CACHE_ALLOC) != 0 && vmd->vmd_pgcache != NULL) {
uma_zfree(vmd->vmd_pgcache, m);
return;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 21, 10:32 PM (1 m, 5 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25817457
Default Alt Text
D20763.id59102.diff (2 KB)

Event Timeline