[Xenomai-git] Philippe Gerum : boilerplate/heapmem: align on HEAPMEM_PAGE_SIZE for non-bucketed blocks

2018-05-20 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 899ad04df1ca3323eed3c2cd432ef4ad9363239c
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=899ad04df1ca3323eed3c2cd432ef4ad9363239c

Author: Philippe Gerum 
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


[Xenomai-git] Philippe Gerum : boilerplate/heapmem: align on HEAPMEM_PAGE_SIZE for non-bucketed blocks

2018-05-15 Thread git repository hosting
Module: xenomai-3
Branch: wip/heapmem
Commit: cc4a1bdbb35f9ea81de6fba84a774284c3a98bc0
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=cc4a1bdbb35f9ea81de6fba84a774284c3a98bc0

Author: Philippe Gerum 
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


[Xenomai-git] Philippe Gerum : boilerplate/heapmem: align on HEAPMEM_PAGE_SIZE for non-bucketed blocks

2018-05-15 Thread git repository hosting
Module: xenomai-3
Branch: wip/heapmem
Commit: d488470dfdef89fb981799bab18c322b15eae6d5
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d488470dfdef89fb981799bab18c322b15eae6d5

Author: Philippe Gerum 
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