Page MenuHomeFreeBSD

D48630.id151183.diff
No OneTemporary

D48630.id151183.diff

diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -1854,7 +1854,13 @@
}
/*
- * Split an entry at the address 'pa'. Return zero on success or errno.
+ * Split a chunk in phys_avail[] at the address 'pa'.
+ *
+ * 'pa' must be within a chunk (slots i and i + 1) or one of its boundaries.
+ * Returns zero on actual split, in which case the two new chunks occupy slots
+ * i to i + 3, else EJUSTRETURN if 'pa' was one of the boundaries (and no split
+ * actually occurred) else ENOSPC if there are not enough slots in phys_avail[]
+ * to represent the additional chunk caused by the split.
*/
static int
vm_phys_avail_split(vm_paddr_t pa, int i)
@@ -1862,8 +1868,12 @@
int cnt;
vm_phys_avail_check(i);
- if (pa <= phys_avail[i] || pa >= phys_avail[i + 1])
- panic("vm_phys_avail_split: invalid address");
+ if (pa < phys_avail[i] || pa > phys_avail[i + 1])
+ panic("%s: Address %#jx not in range at slot %d [%#jx;%#jx].",
+ __func__, (uintmax_t)pa, i,
+ (uintmax_t)phys_avail[i], (uintmax_t)phys_avail[i + 1]);
+ if (pa == phys_avail[i] || pa == phys_avail[i + 1])
+ return (EJUSTRETURN);
cnt = vm_phys_avail_count();
if (cnt >= PHYS_AVAIL_ENTRIES)
return (ENOSPC);
@@ -2025,12 +2035,10 @@
for (i = 0; mem_affinity[i].end != 0; i++) {
idx = vm_phys_avail_find(mem_affinity[i].start);
- if (idx != -1 &&
- phys_avail[idx] != mem_affinity[i].start)
+ if (idx != -1)
vm_phys_avail_split(mem_affinity[i].start, idx);
idx = vm_phys_avail_find(mem_affinity[i].end);
- if (idx != -1 &&
- phys_avail[idx] != mem_affinity[i].end)
+ if (idx != -1)
vm_phys_avail_split(mem_affinity[i].end, idx);
}
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 24, 4:41 AM (9 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35431054
Default Alt Text
D48630.id151183.diff (1 KB)

Event Timeline