blob: bf44f686977df68f01697ca292f43b602bbe28a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#!/system/bin/sh
BIG_CPUS=
LITTLE_CPUS=
FIRST_LITTLE_CPU=
ALL_CPUS=
for cpufile in /sys/devices/system/cpu/cpu*/uevent; do
cpunum=${cpufile#/sys/devices/system/cpu/cpu}
cpunum=${cpunum%/uevent}
if grep -q -e 'ananke' $cpufile; then
echo CPU $cpunum is little core
LITTLE_CPUS=${LITTLE_CPUS:+$LITTLE_CPUS,}$cpunum
FIRST_LITTLE_CPU=${FIRST_LITTLE_CPU:-$cpunum}
elif grep -q -e 'prometheus' $cpufile; then
echo CPU $cpunum is big core
BIG_CPUS=${BIG_CPUS:+$BIG_CPUS,}$cpunum
else
echo CPU $cpunum is unknown type
fi
ALL_CPUS=${ALL_CPUS:+$ALL_CPUS,}$cpunum
done
echo BIG_CPUS=$BIG_CPUS
echo LITTLE_CPUS=$LITTLE_CPUS
echo FIRST_LITTLE_CPU=$FIRST_LITTLE_CPU
# Foreground should contain all cores
echo $ALL_CPUS >/dev/cpuset/foreground/cpus
# 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.
if [ -n "${BIG_CPUS}" ]; then
echo $BIG_CPUS >/dev/cpuset/foreground/boost/cpus
else
# set with all cpus if not found any BIG_CPUS
echo $ALL_CPUS >/dev/cpuset/foreground/boost/cpus
fi
#background contains a small subset (generally one little core)
if [ -n "${FIRST_LITTLE_CPU}" ]; then
echo $FIRST_LITTLE_CPU >/dev/cpuset/background/cpus
else
# use cpu0 if not find any LITTLE CPUS
# same as default
echo 0 >/dev/cpuset/background/cpus
fi
# 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
|