Page MenuHomeFreeBSD

D26769.diff
No OneTemporary

D26769.diff

Index: head/sys/kern/subr_vmem.c
===================================================================
--- head/sys/kern/subr_vmem.c
+++ head/sys/kern/subr_vmem.c
@@ -266,8 +266,8 @@
* allocation will not fail once bt_fill() passes. To do so we cache
* at least the maximum possible tag allocations in the arena.
*/
-static int
-bt_fill(vmem_t *vm, int flags)
+static __noinline int
+_bt_fill(vmem_t *vm, int flags)
{
bt_t *bt;
@@ -307,6 +307,14 @@
return 0;
}
+static inline int
+bt_fill(vmem_t *vm, int flags)
+{
+ if (vm->vm_nfreetags >= BT_MAXALLOC)
+ return (0);
+ return (_bt_fill(vm, flags));
+}
+
/*
* Pop a tag off of the freetag stack.
*/
@@ -1104,7 +1112,7 @@
/*
* Make sure we have enough tags to complete the operation.
*/
- if (vm->vm_nfreetags < BT_MAXALLOC && bt_fill(vm, flags) != 0)
+ if (bt_fill(vm, flags) != 0)
goto out;
/*
@@ -1387,11 +1395,9 @@
* Make sure we have enough tags to complete the
* operation.
*/
- if (vm->vm_nfreetags < BT_MAXALLOC &&
- bt_fill(vm, flags) != 0) {
- error = ENOMEM;
+ error = bt_fill(vm, flags);
+ if (error != 0)
break;
- }
/*
* Scan freelists looking for a tag that satisfies the
@@ -1510,13 +1516,12 @@
{
int error;
- error = 0;
flags &= VMEM_FLAGS;
+
VMEM_LOCK(vm);
- if (vm->vm_nfreetags >= BT_MAXALLOC || bt_fill(vm, flags) == 0)
+ error = bt_fill(vm, flags);
+ if (error == 0)
vmem_add1(vm, addr, size, BT_TYPE_SPAN_STATIC);
- else
- error = ENOMEM;
VMEM_UNLOCK(vm);
return (error);

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 21, 12:03 PM (19 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34148692
Default Alt Text
D26769.diff (1 KB)

Event Timeline