Module: xenomai-3 Branch: wip/heapmem Commit: cc4a1bdbb35f9ea81de6fba84a774284c3a98bc0 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc4a1bdbb35f9ea81de6fba84a774284c3a98bc0
Author: Philippe Gerum <r...@xenomai.org> Date: Tue May 15 18:24:02 2018 +0200 boilerplate/heapmem: align on HEAPMEM_PAGE_SIZE for non-bucketed blocks --- lib/boilerplate/heapmem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/boilerplate/heapmem.c b/lib/boilerplate/heapmem.c index f5b842d..5097d1c 100644 --- a/lib/boilerplate/heapmem.c +++ b/lib/boilerplate/heapmem.c @@ -426,9 +426,12 @@ void *heapmem_alloc(struct heap_memory *heap, size_t size) log2size = HEAPMEM_MIN_LOG2; } else { log2size = sizeof(size) * CHAR_BIT - 1 - __clz(size); - if (size & (size - 1)) - log2size++; - bsize = 1 << log2size; + if (log2size < HEAPMEM_PAGE_SHIFT) { + if (size & (size - 1)) + log2size++; + bsize = 1 << log2size; + } else + bsize = __align_to(size, HEAPMEM_PAGE_SIZE); } /* _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git