无滴答的内核,isolcpus,nohz_full和rcu_nocbs [英] tickless kernel , isolcpus,nohz_full,and rcu_nocbs

查看:2090
本文介绍了无滴答的内核,isolcpus,nohz_full和rcu_nocbs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在grub.conf中添加了"isolcpus = 3 nohz_full = 3 rcu_nocbs = 3" RedHat 7.1,内核:linux 3.10.0-229内核,并根据 http://www .breakage.org/2013/11/15/nohz_fullgodmode/ 我还执行以下命令:

I have add "isolcpus=3 nohz_full=3 rcu_nocbs=3" in grub.conf in RedHat 7.1 , kernel: linux 3.10.0-229 kernel and according to http://www.breakage.org/2013/11/15/nohz_fullgodmode/ I also execute the following command :

cat /sys/bus/workqueue/devices/writeback/cpumask
f
echo 1 > /sys/bus/workqueue/devices/writeback/cpumask

cat /sys/bus/workqueue/devices/writeback/numa
1
echo 0 > /sys/bus/workqueue/devices/writeback/numa

该盒子只有4个cpu核心,我运行以下shell:

The box has only 4 cpu cores , I run the following shell :

watch -d 'cat /proc/interrupts'

看起来很完美,只有cpu0本地计时器中断每2秒具有2000次, else cpu 1到cpu 3的每2秒少于10个.

look like work perfect , only cpu0 Local timer interrupts has 2000 per 2 secs, the else cpu 1 to cpu 3 has less than 10 per 2 secs .

然后测试以下来源:

void *Thread2(void *param)
{
    pthread_detach(pthread_self());
    while( 1 ){
        sleep( 100000 ) ;
    }
}

void *Thread1(void *param)
{
    pthread_detach(pthread_self());
    while( 1 ){
        ;
    }
}

int main(int argc, char** argv)
{
    pthread_t tid ;
    pthread_create(&tid , NULL, Thread1, (void*)(long)3);
    pthread_create(&tid , NULL, Thread2, (void*)(long)3);

    while( 1 )
        sleep( 5 ) ;
}

并通过运行:

taskset -c 3 ./x1.exe

观看以下内容的输出:

watch -d 'cat /proc/interrupts'

这次,CPU 3每2秒获得10〜30个本地计时器中断,看起来不错, 然后我尝试通过以下方式运行2个thread1:

this time , cpu 3 get 10~30 Local timer interrupts per 2 secs , look fine, then I try to run 2 thread1 by :

pthread_create(&tid , NULL, Thread1, (void*)(long)3);
pthread_create(&tid , NULL, Thread1, (void*)(long)3);

然后再次运行它:

taskset -c 3 ./x1.exe

然后我看到核心3与核心0具有相同的本地计时器中断, 每2秒2000次中断.

then I watch the core 3 has the same Local timer interrupts with core 0 , it is 2000 interrupts per 2 secs .

请问一下,为什么2个非常繁忙的thread1会导致core 3具有 更多的计时器中断吗?这是什么原因造成的? 以及如何对其进行修改?!

May I ask , why 2 very busy thread1 will cause core 3 has much more timer interrupts ?! what cause this happened ?! and how to modify it if it can be ?!

推荐答案

在第二种情况下,内核需要在核心3上调度2个CPU绑定的任务,并且动态滴答配置仅在恰好有一个可运行任务时才适用. 我以为SCHED_FIFO会停止这些中断(所以我开始回答),但是根据 https://www.kernel.org/doc/Documentation/timers/NO_HZ.txt

In the second case, Kernel needs to schedule 2 cpu bound tasks on core 3 and the dynamic ticks configuration is applicable only when there is exactly one runnable task. I thought SCHED_FIFO would stop these interrupts (and so I started answering), but that isn't yet implemented as per https://www.kernel.org/doc/Documentation/timers/NO_HZ.txt

除了在不同的CPU上调度线程外,没有其他方法可以更改此行为.您总是可以破解内核来实现所需的功能.

There is no way to change this behaviour except scheduling threads on different CPUs. You can always hack the kernel to achieve what you need.

这篇关于无滴答的内核,isolcpus,nohz_full和rcu_nocbs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆