Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149481098
D32701.id97593.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D32701.id97593.diff
View Options
Index: sys/kern/subr_physmem.c
===================================================================
--- sys/kern/subr_physmem.c
+++ sys/kern/subr_physmem.c
@@ -278,19 +278,32 @@
vm_size_t size, uint32_t flags)
{
size_t i;
+ vm_paddr_t nend, rend;
struct region *ep, *rp;
+ nend = addr + size;
ep = regions + rcnt;
for (i = 0, rp = regions; i < rcnt; ++i, ++rp) {
- if (rp->addr == addr && rp->size == size) /* Pure dup. */
- return (rcnt);
if (flags == rp->flags) {
- if (addr + size == rp->addr) {
+ rend = rp->addr + rp->size;
+ if (addr <= rp->addr && nend >= rp->addr) {
+ /*
+ * New mapping overlaps at the beginning, shift
+ * for any difference in the beginning then
+ * shift if the new mapping extends past.
+ */
+ rp->size += rp->addr - addr;
rp->addr = addr;
- rp->size += size;
+ if (nend >= rend)
+ rp->size += nend - rend;
return (rcnt);
- } else if (rp->addr + rp->size == addr) {
- rp->size += size;
+ } else if (addr <= rend && nend > rp->addr) {
+ /*
+ * New mapping is either entirely contained
+ * within or it's overlapping at the end.
+ */
+ if (nend > rend)
+ rp->size += nend - rend;
return (rcnt);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 25, 6:03 PM (16 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30338257
Default Alt Text
D32701.id97593.diff (1 KB)
Attached To
Mode
D32701: kern: physmem: improve region coalescing logic
Attached
Detach File
Event Timeline
Log In to Comment