Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149653410
D49391.1790650867.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D49391.1790650867.diff
View Options
Index: sys/vm/vm_page.h
===================================================================
--- sys/vm/vm_page.h
+++ sys/vm/vm_page.h
@@ -534,7 +534,7 @@
#define VM_ALLOC_INTERRUPT 1
#define VM_ALLOC_SYSTEM 2
#define VM_ALLOC_CLASS_MASK 3
-#define VM_ALLOC_WAITOK 0x0008 /* (acn) Sleep and retry */
+#define VM_ALLOC_WAITOK 0x0008 /* (cn) Sleep and retry */
#define VM_ALLOC_WAITFAIL 0x0010 /* (acn) Sleep and return error */
#define VM_ALLOC_WIRED 0x0020 /* (acgnp) Allocate a wired page */
#define VM_ALLOC_ZERO 0x0040 /* (acgnp) Allocate a zeroed page */
@@ -544,7 +544,7 @@
#define VM_ALLOC_NOCREAT 0x0400 /* (gp) Don't create a page */
#define VM_ALLOC_AVAIL1 0x0800
#define VM_ALLOC_IGN_SBUSY 0x1000 /* (gp) Ignore shared busy flag */
-#define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */
+#define VM_ALLOC_NODUMP 0x2000 /* (acgnp) don't include in dump */
#define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */
#define VM_ALLOC_NOWAIT 0x8000 /* (acgnp) Do not sleep */
#define VM_ALLOC_COUNT_MAX 0xffff
Index: sys/vm/vm_page.c
===================================================================
--- sys/vm/vm_page.c
+++ sys/vm/vm_page.c
@@ -4756,12 +4756,11 @@
/*
* vm_page_grab_sleep
*
- * Sleep for busy according to VM_ALLOC_ parameters. Returns true
- * if the caller should retry and false otherwise.
+ * Sleep for busy according to VM_ALLOC_ parameters. Returns true if
+ * allocflags permits waiting and false otherwise.
*
- * If the object is locked on entry the object will be unlocked with
- * false returns and still locked but possibly having been dropped
- * with true returns.
+ * The object may be locked on entry. If so, lock will be released and
+ * reacquired if the routine sleeps.
*/
static bool
vm_page_grab_sleep(vm_object_t object, vm_page_t m, vm_pindex_t pindex,
@@ -4781,8 +4780,6 @@
if (_vm_page_busy_sleep(object, m, pindex, wmesg, allocflags, locked) &&
locked)
VM_OBJECT_WLOCK(object);
- if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
- return (false);
return (true);
}
@@ -4796,11 +4793,14 @@
KASSERT((allocflags & VM_ALLOC_NOBUSY) == 0 ||
(allocflags & VM_ALLOC_WIRED) != 0,
- ("vm_page_grab*: the pages must be busied or wired"));
+ ("%s: the pages must be busied or wired", __func__));
KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 ||
(allocflags & VM_ALLOC_IGN_SBUSY) != 0,
- ("vm_page_grab*: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch"));
+ ("%s: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch", __func__));
+
+ KASSERT((allocflags & VM_ALLOC_WAITFAIL) == 0,
+ ("%s: Invalid waitfail flag", __func__));
}
/*
@@ -4812,8 +4812,8 @@
int pflags;
pflags = allocflags &
- ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL |
- VM_ALLOC_NOBUSY | VM_ALLOC_IGN_SBUSY);
+ ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_NOBUSY |
+ VM_ALLOC_IGN_SBUSY);
if ((allocflags & VM_ALLOC_NOWAIT) == 0)
pflags |= VM_ALLOC_WAITFAIL;
if ((allocflags & VM_ALLOC_IGN_SBUSY) != 0)
@@ -4855,7 +4855,7 @@
return (NULL);
m = vm_page_alloc(object, pindex, vm_page_grab_pflags(allocflags));
if (m == NULL) {
- if ((allocflags & (VM_ALLOC_NOWAIT | VM_ALLOC_WAITFAIL)) != 0)
+ if ((allocflags & VM_ALLOC_NOWAIT) != 0)
return (NULL);
goto retrylookup;
}
@@ -4954,11 +4954,8 @@
vm_page_t ma[VM_INITIAL_PAGEIN];
int after, i, pflags, rv;
- KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 ||
- (allocflags & VM_ALLOC_IGN_SBUSY) != 0,
- ("vm_page_grab_valid: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY mismatch"));
- KASSERT((allocflags &
- (VM_ALLOC_NOWAIT | VM_ALLOC_WAITFAIL | VM_ALLOC_ZERO)) == 0,
+ vm_page_grab_check(allocflags);
+ KASSERT((allocflags & (VM_ALLOC_NOWAIT | VM_ALLOC_ZERO)) == 0,
("vm_page_grab_valid: Invalid flags 0x%X", allocflags));
VM_OBJECT_ASSERT_WLOCKED(object);
pflags = allocflags & ~(VM_ALLOC_NOBUSY | VM_ALLOC_SBUSY |
@@ -5116,12 +5113,8 @@
int flags;
int error;
- KASSERT((allocflags & VM_ALLOC_SBUSY) == 0 ||
- (allocflags & VM_ALLOC_IGN_SBUSY) != 0,
- ("vm_page_grab_valid_unlocked: VM_ALLOC_SBUSY/VM_ALLOC_IGN_SBUSY "
- "mismatch"));
- KASSERT((allocflags &
- (VM_ALLOC_NOWAIT | VM_ALLOC_WAITFAIL | VM_ALLOC_ZERO)) == 0,
+ vm_page_grab_check(allocflags);
+ KASSERT((allocflags & (VM_ALLOC_NOWAIT | VM_ALLOC_ZERO)) == 0,
("vm_page_grab_valid_unlocked: Invalid flags 0x%X", allocflags));
/*
@@ -5218,8 +5211,7 @@
m = vm_page_alloc_after(object, pindex + i,
pflags | VM_ALLOC_COUNT(count - i), mpred);
if (m == NULL) {
- if ((allocflags & (VM_ALLOC_NOWAIT |
- VM_ALLOC_WAITFAIL)) != 0)
+ if ((allocflags & VM_ALLOC_NOWAIT) != 0)
break;
goto retrylookup;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 29, 3:01 AM (10 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29996992
Default Alt Text
D49391.1790650867.diff (4 KB)
Attached To
Mode
D49391: vm_page: update legend documenting allocation
Attached
Detach File
Event Timeline
Log In to Comment