From a60c78602d2b6746ad093fc3fd30fcc8980aac55 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 25 Feb 2016 15:32:06 -0600 Subject: Remove busybox modprobe to fix slow performance for some devices bionic process initialization calls personality (specifically personality-8) personality wants to load a kernel module loading a kernel module calls /sbin/modprobe loading /sbin/modprobe is a bionic process initialization bionic process initialization calls personality personality wants to load a kernel module loading a kernel module calls /sbin/modprobe . . . Before you know it, it takes 0.5 seconds to do anything. Note: modprobe is still technically available, but the symlink has been removed, so you can still call it directly by running busybox modprobe if you like. From what I can tell, this issue only affects 32 bit devices with CONFIG_MODULES=y in the defconfig. The problem can be also patched out of the kernel by commenting or otherwise removing the block of code in kernel/exec_domain.c inside the CONFIG_MODULES ifdef block It is also possible to patch the problem in bionic libc by commenting out or otherwise removing the __initialize_personality in bionic/libc/ bionic/libc_init_common.cpp file. Change-Id: Iebac314616080ac18320d73b087980ac1b98b951 --- Android.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Android.mk b/Android.mk index 2a91c09ef..08dbf6e16 100644 --- a/Android.mk +++ b/Android.mk @@ -466,6 +466,16 @@ include $(CLEAR_VARS) BUSYBOX_LINKS := $(shell cat external/busybox/busybox-full.links) exclude := tune2fs mke2fs mkdosfs mkfs.vfat gzip gunzip +# Having /sbin/modprobe present on 32 bit devices with can cause a massive +# performance problem if the kernel has CONFIG_MODULES=y +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -gt 22; echo $$?),0) + ifneq ($(TARGET_ARCH), arm64) + ifneq ($(TARGET_ARCH), x86_64) + exclude += modprobe + endif + endif +endif + # If busybox does not have restorecon, assume it does not have SELinux support. # Then, let toolbox provide 'ls' so -Z is available to list SELinux contexts. ifeq ($(TWHAVE_SELINUX), true) -- cgit v1.2.3