init.hikey.rc & BoardConfig.mk: enable cpuset correctly

set the cpu cores for cpuset correctly, otherwise there will
be only cpu0 used for foreground tasks

Change-Id: Ia6c951649a17f2dbd5fcf828d60ac787fb61f10f
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/BoardConfig.mk b/BoardConfig.mk
index d318cd9..4309696 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -49,6 +49,9 @@
 BOARD_FLASH_BLOCK_SIZE := 131072
 TARGET_USE_PAN_DISPLAY := true
 
+# enable to use the CPUSETS feature
+ENABLE_CPUSETS := true
+
 BOARD_SEPOLICY_DIRS := device/linaro/hikey/sepolicy
 
 ifeq ($(HOST_OS), linux)
diff --git a/init.hikey.rc b/init.hikey.rc
index 93e40ed..deeff2c 100644
--- a/init.hikey.rc
+++ b/init.hikey.rc
@@ -61,6 +61,25 @@
 # https://bugs.launchpad.net/bugs/1037611
     chmod 0660 /dev/cpuctl
 
+    # update cpuset now that processors are up
+    # Foreground should contain all cores
+    write /dev/cpuset/foreground/cpus 0-7
+
+    # Add foreground/boost cpuset, it is used for app launches,
+    # and maybe other high priority tasks in the future.
+    # It's to be set to whatever cores should be used
+    # for short term high-priority tasks.
+    write /dev/cpuset/foreground/boost/cpus 0-7
+
+    #background contains a small subset (generally one little core)
+    write /dev/cpuset/background/cpus 0
+
+    # add system-background cpuset, a new cpuset for system services
+    # that should not run on larger cores
+    # system-background is for system tasks that should only run on
+    # little cores, not on bigs to be used only by init
+    write /dev/cpuset/system-background/cpus 0-4
+
 # enable Google-specific location features,
 # like NetworkLocationProvider and LocationCollector
     setprop ro.com.google.locationfeatures 1