From 2fd81ef71c10aecf6583facdd79f8f60f3eed678 Mon Sep 17 00:00:00 2001 From: Jack Ren Date: Sat, 19 Nov 2011 09:48:03 +0800 Subject: [PATCH] bionic: allow the board to customize MALLOC_ALIGNMENT Currently the dlmalloc allocates the memory with 8-byte alignment. According to the com.aurorasoftworks.quadrant.ui.professional benchmark data: We can get much better memory performance if we change it to be 16-byte aligned. For example, On Nexus-S: 8-byte aligned : 1378 1070 1142 1665 1765 1163 1179 1263 1404 avg: 1336.555555556 16-byte aligned: 1691 1731 1780 1691 1671 1678 1802 1758 1780 avg: 1731.333333333 gain: 29.53% That patch provides flexibity to customize the MALLOC_ALIGNMENT from the board config.The macro MALLOC_ALIGNMENT defaults to 8. To change it, please define BOARD_MALLOC_ALIGNMENT in the BoardConfig.mk: BOARD_MALLOC_ALIGNMENT := Change-Id: I8da0376944a0bbcef1d0fc026bfb6d9125db9739 Signed-off-by: Jin Wei Signed-off-by: Jack Ren Signed-off-by: Beare, Bruce J --- libc/Android.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libc/Android.mk b/libc/Android.mk index f7e0e8ff1..8e86d264e 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -459,6 +459,13 @@ ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) libc_common_cflags += -DDEBUG endif +# To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in +# the appropriate BoardConfig.mk file. +# +ifneq ($(BOARD_MALLOC_ALIGNMENT),) + libc_common_cflags += -DMALLOC_ALIGNMENT=$(BOARD_MALLOC_ALIGNMENT) +endif + ifeq ($(TARGET_ARCH),arm) libc_common_cflags += -fstrict-aliasing libc_crt_target_cflags := -mthumb-interwork -- 2.11.0