Re: [PATCH] sched/fair: Optimize select_idle_cpu
From: chengjian (D)
Date: Thu Dec 12 2019 - 09:56:57 EST
On 2019/12/12 22:41, Cheng Jian wrote:
Our threads are all bind to the front CPUs of the LLC domain,
and now all the threads runs on the last CPU of them. nr is
always less than the cpumask_weight, for_each_cpu_wrap can't
find the CPU which our threads can run on, so the threads stay
at the last CPU all the time.
Test :
Run on ARM64 4NODE, 128 CORE
// cat a.c
#include <time.h>
int main(void)
{
ÂÂÂ struct timespec time, save;
ÂÂÂ int ret;
ÂÂÂ time.tv_sec = 0;
ÂÂÂ time.tv_nsec = 1;
ÂÂÂ while (1) {
ÂÂÂÂÂÂÂ ret = nanosleep(&time, &save);
ÂÂÂÂÂÂÂ if (ret)
ÂÂÂÂÂÂÂÂÂÂÂ nanosleep(&save, &save);
ÂÂÂ }
ÂÂÂ return 0;
}
#cat a.sh
for i in `seq 0 9`
do
ÂÂÂ taskset -c 8-11 ./a.out &
done
then run:
ÂÂÂ gcc a.c -o a.out
ÂÂÂ sh a.sh
without this patch, you can see all the task run on CPU11 all the times.
 %Cpu8 : 0.0 us, 0.0 sy, 0.0 ni, 98.4 id, 0.0 wa, 1.6 hi, 0.0
si, 0.0 st
 %Cpu9 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0
si, 0.0 st
 %Cpu10 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0
si, 0.0 st
 %Cpu11 : 5.7 us, 40.0 sy, 0.0 ni, 45.7 id, 0.0 wa, 8.6 hi, 0.0
si, 0.0 st