svn commit: r262881 - projects/sendfile/sys/vm
Gleb Smirnoff
glebius at FreeBSD.org
Fri Mar 7 01:13:48 UTC 2014
Author: glebius
Date: Fri Mar 7 01:13:48 2014
New Revision: 262881
URL: http://svnweb.freebsd.org/changeset/base/262881
Log:
Add VM_ALLOC_NOWAIT flag, that tells vm_page_grab() to fail in case if
it needs to sleep(9).
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Modified:
projects/sendfile/sys/vm/vm_page.c
projects/sendfile/sys/vm/vm_page.h
Modified: projects/sendfile/sys/vm/vm_page.c
==============================================================================
--- projects/sendfile/sys/vm/vm_page.c Fri Mar 7 01:01:57 2014 (r262880)
+++ projects/sendfile/sys/vm/vm_page.c Fri Mar 7 01:13:48 2014 (r262881)
@@ -2689,6 +2689,8 @@ retrylookup:
sleep = (allocflags & VM_ALLOC_IGN_SBUSY) != 0 ?
vm_page_xbusied(m) : vm_page_busied(m);
if (sleep) {
+ if (allocflags & VM_ALLOC_NOWAIT)
+ return (NULL);
/*
* Reference the page before unlocking and
* sleeping so that the page daemon is less
@@ -2716,6 +2718,8 @@ retrylookup:
}
m = vm_page_alloc(object, pindex, allocflags & ~VM_ALLOC_IGN_SBUSY);
if (m == NULL) {
+ if (allocflags & VM_ALLOC_NOWAIT)
+ return (NULL);
VM_OBJECT_WUNLOCK(object);
VM_WAIT;
VM_OBJECT_WLOCK(object);
Modified: projects/sendfile/sys/vm/vm_page.h
==============================================================================
--- projects/sendfile/sys/vm/vm_page.h Fri Mar 7 01:01:57 2014 (r262880)
+++ projects/sendfile/sys/vm/vm_page.h Fri Mar 7 01:13:48 2014 (r262881)
@@ -390,6 +390,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa)
#define VM_ALLOC_IGN_SBUSY 0x1000 /* vm_page_grab() only */
#define VM_ALLOC_NODUMP 0x2000 /* don't include in dump */
#define VM_ALLOC_SBUSY 0x4000 /* Shared busy the page */
+#define VM_ALLOC_NOWAIT 0x8000 /* Return NULL instead of sleeping */
#define VM_ALLOC_COUNT_SHIFT 16
#define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT)
More information about the svn-src-projects
mailing list