[Galaxy S Plus I9001 Android Development] Christopher83:
Kernel Optimization Benchmarks​

These are the results of the comparative benchmarks of the performance results that can be achieved using the different kernel optimization options (-Os, -O2, -O3), using cpu and floating point tuning (eg -march=armv7-a -mtune=cortex-a8 -mfpu=neon) and other additional compilation flags.

For these tests I've used different kernels based on Arco's 3.0.60 kernel sources and built using the same toolchain (optimized for generic Cortex-A cpu):

- pure kernel built selecting -Os optimization

- pure kernel built selecting -O2 optimization

- slighty modified kernel built selecting -O3 optimization (only two simple changes to add -O3 optimization option inside Makefile and init/Kconfig)

- slighty modified kernel built selecting -O3 optimization and with the following additional compilation flags inside Makefile

...
OPTIMIZATION_FLAGS = -march=armv7-a -mtune=cortex-a8 -mfpu=neon \
-ffast-math -fsingle-precision-constant \
-fgcse-lm -fgcse-sm -fsched-spec-load -fforce-addr
CFLAGS_MODULE = $(OPTIMIZATION_FLAGS)
AFLAGS_MODULE = $(OPTIMIZATION_FLAGS)
LDFLAGS_MODULE =
CFLAGS_KERNEL = $(OPTIMIZATION_FLAGS)
AFLAGS_KERNEL = $(OPTIMIZATION_FLAGS)
...

and

...
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
KBUILD_CFLAGS += -Os
endif
ifdef CONFIG_CC_OPTIMIZE_DEFAULT
KBUILD_CFLAGS += -O2
endif
ifdef CONFIG_CC_OPTIMIZE_MORE
KBUILD_CFLAGS += -O3 -fmodulo-sched -fmodulo-sched-allow-regmoves -fno-tree-vectorize
endif
ifdef CONFIG_CC_OPTIMIZE_FAST
KBUILD_CFLAGS += -Ofast
endif
...

The kernel has not been overclocked, I used the default min and max cpu frequencies (245 Mhz - 1401 Mhz) with Performance cpu governor and Noop I/O scheduler.

To perform each kernel benchmark, I made at least 3 test runs for each of the following tools:

- CF-Bench developed by XDA Developer Chainfire

- Antutu Benchmark

Benchmark final results

(the image is uploaded on Media Fire, if you can't see it, could be due to your proxy configuration)
​

You can find more detailed results (ods, xlsx and pdf format) and screenshots inside the following Media Fire folder:

Results Folder​

Conclusion:

As you can see, if compared with each other, -O2 optimization and -O3 optimization with additional flags give the best results in terms of performance, expecially using CF-Bench, but the differences are relatively small.

Thus, we can conclude by saying that the optimization flags above, do not do miracles, at least in terms of performance...

Memory Allocators Benchmarks​

These are the results of the comparative benchmarks of the performance results that can be achieved selecting one of the different kernel memory allocators (SLUB, SLAB, SLOB and SLQB).

For these tests I've used different builds of the above descripted kernel (slighty modified kernel built selecting -O3 optimization and with the additional compilation flags):

- a build configured selecting the default SLUB memory allocator (the unqueued slab allocator V6)

- a build configured selecting the SLAB memory allocator (old and deprecated)

- a build configured selecting the SLOB memory allocator (a simpler memory allocator suitable for embedded devices with low memory)

- a build configured selecting the SLQB memory allocator (I modified the kernel sources to add it)

The kernel has not been overclocked, I used the default min and max cpu frequencies (245 Mhz - 1401 Mhz) with Performance cpu governor and Noop I/O scheduler.

To perform each kernel benchmark, I made at least 3 test runs for each of the following tools:

- CF-Bench developed by XDA Developer Chainfire

- Antutu Benchmark

Benchmark final results

(the image is uploaded on Media Fire, if you can't see it, could be due to your proxy configuration)
​

You can find more detailed results (ods, xlsx and pdf format) and screenshots inside the following Media Fire folder:

Results Folder​

Conclusion:

In this case, if compared with each other, SLUB memory allocator (which is the default one) and SLQB memory allocator give the best results in terms of performance. The differences between these two are relatively small.

Patch:

If you want to add the SLQB memory allocator inside your JB kernel sources, you can use the following patch

SLQB_memory_allocator.patch​

After downloading it inside your kernel sources folder:

[COLOR="Navy"]Show the changes inside the patch[/COLOR]
[B]git apply --stat SLQB_memory_allocator.patch[/B]

[COLOR="Navy"]Check if the patch could cause conflicts or other problems[/COLOR]
[B]git apply --check SLQB_memory_allocator.patch[/B]

[COLOR="Navy"]If all is ok, apply the patch[/COLOR]
[B]git am --signoff SLQB_memory_allocator.patch[/B]