Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153124350
D28219.id82503.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
D28219.id82503.diff
View Options
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -768,20 +768,25 @@
struct malloc_type *mtp, struct domainset *ds, int flags)
{
void *res;
+ size_t asize;
KASSERT(align != 0 && powerof2(align),
("malloc_domainset_aligned: wrong align %#zx size %#zx",
align, size));
- KASSERT(align <= kmemzones[nitems(kmemzones) - 2].kz_size,
+ KASSERT(align <= PAGE_SIZE,
("malloc_domainset_aligned: align %#zx (size %#zx) too large",
align, size));
if (size < align)
- size = align;
- res = malloc_domainset(size, mtp, ds, flags);
+ asize = align;
+ else if (!powerof2(size))
+ asize = roundup2(size, align);
+ else
+ asize = size;
+ res = malloc_domainset(asize, mtp, ds, flags);
KASSERT(res == NULL || ((uintptr_t)res & (align - 1)) == 0,
("malloc_domainset_aligned: result not aligned %p size %#zx "
- "align %#zx", res, size, align));
+ "allocsize %#zx align %#zx", res, size, asize, align));
return (res);
}
@@ -1173,7 +1178,7 @@
align = UMA_ALIGN_PTR;
if (powerof2(size) && size > sizeof(void *))
- align = size - 1;
+ align = (size <= PAGE_SIZE ? size : PAGE_SIZE) - 1;
for (subzone = 0; subzone < numzones; subzone++) {
kmemzones[indx].kz_zone[subzone] =
uma_zcreate(name, size,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 20, 8:11 AM (19 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31827289
Default Alt Text
D28219.id82503.diff (1 KB)
Attached To
Mode
D28219: Restrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE.
Attached
Detach File
Event Timeline
Log In to Comment