Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107859224
D45970.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D45970.diff
View Options
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -457,6 +457,7 @@
#define PG_ZERO 0x04 /* page is zeroed */
#define PG_MARKER 0x08 /* special queue marker page */
#define PG_NODUMP 0x10 /* don't include this page in a dump */
+#define PG_NOFREE 0x20 /* page should never be freed. */
/*
* Misc constants.
@@ -537,7 +538,7 @@
#define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */
#define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */
#define VM_ALLOC_NORECLAIM 0x0080 /* (c) Do not reclaim after failure */
-#define VM_ALLOC_AVAIL0 0x0100
+#define VM_ALLOC_NOFREE 0x0100 /* (an) Page will never be released */
#define VM_ALLOC_NOBUSY 0x0200 /* (acgp) Do not excl busy the page */
#define VM_ALLOC_NOCREAT 0x0400 /* (gp) Don't create a page */
#define VM_ALLOC_AVAIL1 0x0800
@@ -575,6 +576,8 @@
pflags |= VM_ALLOC_WAITOK;
if ((malloc_flags & M_NORECLAIM))
pflags |= VM_ALLOC_NORECLAIM;
+ if ((malloc_flags & M_NEVERFREED))
+ pflags |= VM_ALLOC_NOFREE;
return (pflags);
}
#endif
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2082,7 +2082,8 @@
#define VPA_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \
VM_ALLOC_NOWAIT | VM_ALLOC_NOBUSY | \
VM_ALLOC_SBUSY | VM_ALLOC_WIRED | \
- VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK)
+ VM_ALLOC_NODUMP | VM_ALLOC_ZERO | \
+ VM_ALLOC_NOFREE | VM_ALLOC_COUNT_MASK)
KASSERT((req & ~VPA_FLAGS) == 0,
("invalid request %#x", req));
KASSERT(((req & (VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY)) !=
@@ -2154,6 +2155,8 @@
flags |= m->flags & PG_ZERO;
if ((req & VM_ALLOC_NODUMP) != 0)
flags |= PG_NODUMP;
+ if ((req & VM_ALLOC_NOFREE) != 0)
+ flags |= PG_NOFREE;
m->flags = flags;
m->a.flags = 0;
m->oflags = (object->flags & OBJ_UNMANAGED) != 0 ? VPO_UNMANAGED : 0;
@@ -2418,11 +2421,13 @@
#define VPAN_FLAGS (VM_ALLOC_CLASS_MASK | VM_ALLOC_WAITFAIL | \
VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | \
VM_ALLOC_NOBUSY | VM_ALLOC_WIRED | \
- VM_ALLOC_NODUMP | VM_ALLOC_ZERO | VM_ALLOC_COUNT_MASK)
+ VM_ALLOC_NODUMP | VM_ALLOC_ZERO | \
+ VM_ALLOC_NOFREE | VM_ALLOC_COUNT_MASK)
KASSERT((req & ~VPAN_FLAGS) == 0,
("invalid request %#x", req));
- flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0;
+ flags = ((req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0) |
+ ((req & VM_ALLOC_NOFREE) != 0 ? PG_NOFREE : 0);
vmd = VM_DOMAIN(domain);
again:
if (vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) {
@@ -3937,6 +3942,8 @@
m, i, (uintmax_t)*p));
}
#endif
+ KASSERT((m->flags & PG_NOFREE) == 0,
+ ("%s: attempting to free a PG_NOFREE page", __func__));
if ((m->oflags & VPO_UNMANAGED) == 0) {
KASSERT(!pmap_page_is_mapped(m),
("vm_page_free_prep: freeing mapped page %p", m));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 7:02 PM (18 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15941694
Default Alt Text
D45970.diff (2 KB)
Attached To
Mode
D45970: vm: Introduce {VM_ALLOC, PG}_NOFREE flags
Attached
Detach File
Event Timeline
Log In to Comment