Browse Source

core: qm/fm memory align size can be set with define KSR_MEMORY_ALIGN

- flexibility to be set at compile time via make or compiler parameter
Daniel-Constantin Mierla 1 year ago
parent
commit
80d1f10507
2 changed files with 11 additions and 2 deletions
  1. 6 1
      src/core/mem/f_malloc.h
  2. 5 1
      src/core/mem/q_malloc.h

+ 6 - 1
src/core/mem/f_malloc.h

@@ -46,10 +46,15 @@
  * can be 32 bits aligned => malloc should return multiple of long long
  * can be 32 bits aligned => malloc should return multiple of long long
  * aligned memory
  * aligned memory
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
  * - sizeof(fm_frag) must be multiple of ROUNDTO!
  * - sizeof(fm_frag) must be multiple of ROUNDTO!
  */
  */
+#ifndef KSR_MEMORY_ALIGN
 #define ROUNDTO 16UL
 #define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
+
 
 
 #define MIN_FRAG_SIZE ROUNDTO
 #define MIN_FRAG_SIZE ROUNDTO
 
 

+ 5 - 1
src/core/mem/q_malloc.h

@@ -39,10 +39,14 @@
  * can be 32 bits aligned => malloc should return multiple of long long
  * can be 32 bits aligned => malloc should return multiple of long long
  * aligned memory
  * aligned memory
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
  * - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
  * - sizeof(qm_frag) and sizeof(qm_frag_end) must be multiple of ROUNDTO!
  * - sizeof(qm_frag) and sizeof(qm_frag_end) must be multiple of ROUNDTO!
  */
  */
+#ifndef KSR_MEMORY_ALIGN
 #define ROUNDTO 16UL
 #define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
 
 
 #define MIN_FRAG_SIZE ROUNDTO
 #define MIN_FRAG_SIZE ROUNDTO