blob: fbf8fa47e2565fe2cf431555c24c9e5bbf2d3d41 (
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
|
#!/system/bin/sh
# This script sets the default affinity to the processors with the given part id.
# - part id is in hex (as seen in /proc/cpuinfo)
function build_mask_from_part_id {
local IFS
local mask
local ref_part_id
ref_part_id=$1
IFS=$'\n'
for line in `cat /proc/cpuinfo`
do
IFS=':'
set -A tokens $line
if [ "${line#'processor'}" != "$line" ]
then
cpu="${tokens[1]##' '}"
elif [ "${line#'CPU part'}" != "$line" ]
then
part_id="${tokens[1]##' '}"
if [ "$part_id" == "$ref_part_id" ]
then
(( mask |= 1 << $cpu ))
fi
fi
done
echo $(printf "%x" $mask)
}
ref_part_id=$(echo $1 | tr '[A-Z]' '[a-z]')
mask=$(build_mask_from_part_id $ref_part_id)
[ -z "$mask" ] && exit
echo $mask > /proc/irq/default_smp_affinity
for i in `ls /proc/irq`
do
affinity_file="/proc/irq/$i/smp_affinity"
[ -e $affinity_file ] && echo $mask > $affinity_file
done
|