Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152977628
D28422.id83124.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
D28422.id83124.diff
View Options
Index: sys/sys/malloc.h
===================================================================
--- sys/sys/malloc.h
+++ sys/sys/malloc.h
@@ -62,6 +62,7 @@
#define M_BESTFIT 0x2000 /* only for vmem, low fragmentation */
#define M_EXEC 0x4000 /* allocate executable space */
#define M_NEXTFIT 0x8000 /* only for vmem, follow cursor */
+#define M_NORECLAIM 0x10000 /* do not reclaim after failure */
#define M_VERSION 2020110501
Index: sys/vm/vm_kern.c
===================================================================
--- sys/vm/vm_kern.c
+++ sys/vm/vm_kern.c
@@ -177,17 +177,22 @@
{
vm_page_t m;
int tries;
- bool wait;
+ bool wait, reclaim;
VM_OBJECT_ASSERT_WLOCKED(object);
+ /* Disallow an invalid combination of flags. */
+ MPASS((pflags & (VM_ALLOC_WAITOK | VM_ALLOC_NORECLAIM)) !=
+ (VM_ALLOC_WAITOK | VM_ALLOC_NORECLAIM));
+
wait = (pflags & VM_ALLOC_WAITOK) != 0;
+ reclaim = (pflags & VM_ALLOC_NORECLAIM) == 0;
pflags &= ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL);
pflags |= VM_ALLOC_NOWAIT;
for (tries = wait ? 3 : 1;; tries--) {
m = vm_page_alloc_contig_domain(object, pindex, domain, pflags,
npages, low, high, alignment, boundary, memattr);
- if (m != NULL || tries == 0)
+ if (m != NULL || tries == 0 || !reclaim)
break;
VM_OBJECT_WUNLOCK(object);
Index: sys/vm/vm_page.h
===================================================================
--- sys/vm/vm_page.h
+++ sys/vm/vm_page.h
@@ -548,6 +548,7 @@
#define VM_ALLOC_NODUMP 0x2000 /* (ag) don't include in dump */
#define VM_ALLOC_SBUSY 0x4000 /* (acgp) Shared busy the page */
#define VM_ALLOC_NOWAIT 0x8000 /* (acfgp) Do not sleep */
+#define VM_ALLOC_NORECLAIM 0x10000 /* (c) Do not reclaim after failure */
#define VM_ALLOC_COUNT_SHIFT 16
#define VM_ALLOC_COUNT(count) ((count) << VM_ALLOC_COUNT_SHIFT)
@@ -570,6 +571,8 @@
pflags |= VM_ALLOC_NOWAIT;
if ((malloc_flags & M_WAITOK))
pflags |= VM_ALLOC_WAITOK;
+ if ((malloc_flags & M_NORECLAIM))
+ pflags |= VM_ALLOC_NORECLAIM;
return (pflags);
}
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 10:53 AM (6 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31763331
Default Alt Text
D28422.id83124.diff (2 KB)
Attached To
Mode
D28422: Add a VM flag to prevent reclaim on a failed contig allocation
Attached
Detach File
Event Timeline
Log In to Comment