hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/scripts/coccicheck
....@@ -75,8 +75,13 @@
7575 OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE"
7676 fi
7777
78
+ # Use only one thread per core by default if hyperthreading is enabled
79
+ THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")
7880 if [ -z "$J" ]; then
7981 NPROC=$(getconf _NPROCESSORS_ONLN)
82
+ if [ $THREADS_PER_CORE -gt 1 -a $NPROC -gt 4 ] ; then
83
+ NPROC=$((NPROC/2))
84
+ fi
8085 else
8186 NPROC="$J"
8287 fi
....@@ -99,7 +104,7 @@
99104 if [ "$MODE" = "" ] ; then
100105 if [ "$ONLINE" = "0" ] ; then
101106 echo 'You have not explicitly specified the mode to use. Using default "report" mode.'
102
- echo 'Available modes are the following: patch, report, context, org'
107
+ echo 'Available modes are the following: patch, report, context, org, chain'
103108 echo 'You can specify the mode with "make coccicheck MODE=<mode>"'
104109 echo 'Note however that some modes are not implemented by some semantic patches.'
105110 fi
....@@ -126,8 +131,14 @@
126131 if [ $VERBOSE -ne 0 ] ; then
127132 echo "Running ($NPROC in parallel): $@"
128133 fi
129
- echo $@ >>$DEBUG_FILE
130
- $@ 2>>$DEBUG_FILE
134
+ if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
135
+ echo $@>>$DEBUG_FILE
136
+ $@ 2>>$DEBUG_FILE
137
+ else
138
+ echo $@
139
+ $@ 2>&1
140
+ fi
141
+
131142 err=$?
132143 if [[ $err -ne 0 ]]; then
133144 echo "coccicheck failed"