Linux内核支持实时线程和非实时线程同时工作,并且可以给实时线程分配适当的执行比例,当超过设置的比例的时候,调度器将不再调度实时线程工作,这样做保证了即便在实时线程不主动放弃CPU的情况下,CPU的占用率也不会到%100,保证了其它线程总有执行时间。
具体实验可以看下片博客:
Linux实时调度策略(SCHED_RR)和CFS(SCHED_OTHER)之间的区别
下面我们分析一下它的内核实现机制,从上篇博客我们知道关键的变量是rt_throttled,系统在调度器初始化阶段会分配RT线程默认的CPU带宽
而初始化bandwidth 依赖的两个关键变量均来自于/proc/sys/kernel下的关键节点配置:
我们尝试调试一下它的变化逻辑,加入下面的补丁:
diff --git a/linux-5.4.138/kernel/sched/rt.c b/linux-5.4.138/kernel/sched/rt.c
index 1e102783d..2dffb8762 100644
--- a/linux-5.4.138/kernel/sched/rt.c
+++ b/linux-5.4.138/kernel/sched/rt.c
@@ -763,10 +763,6 @@ static void __disable_runtime(struct rq *rq)
* runtime - in which case borrowing doesn't make sense.
*/
rt_rq->rt_runtime = RUNTIME_INF;
- //if(strcmp("a.out", current->comm) == 0)
- {
- printk("%s line %d, throttled is %d, set to zero, comm %s.rq_rq = %p\n", __func__, __LINE__, rt_rq->rt_throttled, current->comm,rt_rq);
- }
rt_rq->rt_throttled = 0;
raw_spin_unlock(&rt_rq->rt_runtime_lock);
raw_spin_unlock(&rt_b->rt_runtime_lock);
@@ -794,10 +790,6 @@ static void __enable_runtime(struct rq *rq)
raw_spin_lock(&rt_rq->rt_runtime_lock);
rt_rq->rt_runtime = rt_b->rt_runtime;
rt_rq->rt_time = 0;
- //if(strcmp("a.out", current->comm) == 0)
- {
- printk("%s line %d, throttled is %d, set to zero, comm %s.rq_rq = %p\n", __func__, __LINE__, rt_rq->rt_throttled, current->comm,rt_rq);
- }
rt_rq->rt_throttled = 0;
raw_spin_unlock(&rt_rq->rt_runtime_lock);
raw_spin_unlock(&rt_b->rt_runtime_lock);
@@ -868,11 +860,6 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)
runtime = rt_rq->rt_runtime;
rt_rq->rt_time -= min(rt_rq->rt_time, overrun*runtime);
if (rt_rq->rt_throttled && rt_rq->rt_time < runtime) {
- //if(strcmp("a.out", current->comm) == 0)
- {
- printk("%s line %d, throttled is %d, set to zero, comm %s.rq_rq = %p\n", __func__, __LINE__, rt_rq->rt_throttled, current->comm,rt_rq);
- }
-
rt_rq->rt_throttled = 0;
enqueue = 1;
@@ -943,9 +930,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
* but accrue some time due to boosting.
*/
if (likely(rt_b->rt_runtime)) {
- printk_deferred_once("sched: RT throttling activated\n");
- printk("%s line %d, throttled set to one, comm %s.pree is %d.rq_rq = %p\n", __func__, __LINE__, current->comm, rt_rq->rt_throttled, rt_rq);
rt_rq->rt_throttled = 1;
+ printk_deferred_once("sched: RT throttling activated\n");
} else {
/*
* In case we did anyway, make it go away,
@@ -1586,20 +1572,12 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq)
static struct task_struct *
pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
{
- static unsigned long counter = 0;
struct task_struct *p;
WARN_ON_ONCE(prev || rf);
if (!sched_rt_runnable(rq))
- {
- counter ++;
- if(counter % 10 == 0)
- {
- printk("%s line %d. comm %s, pick next is null, throttled.\n", __func__, __LINE__, prev->comm);
- }
return NULL;
- }
p = _pick_next_task_rt(rq);
set_next_task_rt(rq, p, true);
修改内核代码rt,增加调试信息,重新编译内核,启动。
编写用户态测试用例,基于Posix创建实时线程
#include <string.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
void *child_thread(void *arg)
{
int policy = 0;
int max_priority = 0,min_priority = 0;
struct sched_param param;
pthread_attr_t attr;
struct sched_param sp;
bzero((void*)&sp, sizeof(sp));
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);
pthread_attr_getinheritsched(&attr,&policy);
if(policy == PTHREAD_EXPLICIT_SCHED){
printf("Inheritsched:PTHREAD_EXPLICIT_SCHED\n");
}
if(policy == PTHREAD_INHERIT_SCHED){
printf("Inheritsched:PTHREAD_INHERIT_SCHED\n");
}
pthread_attr_setschedpolicy(&attr,SCHED_RR);
//pthread_attr_setschedpolicy(&attr,SCHED_OTHER);
pthread_attr_getschedpolicy(&attr,&policy);
if(policy == SCHED_FIFO){
printf("Schedpolicy:SCHED_FIFO\n");
}
if(policy == SCHED_RR){
printf("Schedpolicy:SCHED_RR\n");
}
if(policy == SCHED_OTHER){
printf("Schedpolicy:SCHED_OTHER\n");
}
max_priority = sched_get_priority_max(policy);
min_priority = sched_get_priority_min(policy);
printf("Maxpriority:%u\n",max_priority);
printf("Minpriority:%u\n",min_priority);
param.sched_priority = max_priority;
pthread_attr_setschedparam(&attr,¶m);
sp.sched_priority = 1;
// Actually set the sched params for the current thread.
if (0 == pthread_setschedparam(pthread_self(), policy, &sp)) {
printf("IO Thread #%ld using high-priority scheduler!", pthread_self());
}
printf("sched_priority:%u\n",param.sched_priority);
while(1);
pthread_attr_destroy(&attr);
}
int main(int argc,char *argv[ ])
{
pthread_t child_thread_id;
pthread_create(&child_thread_id,NULL,child_thread,NULL);
pthread_join(child_thread_id,NULL);
return 0;
}
编译生成a.out.
修改sched_rt_runtime_us的值,将RT线程的占比从%95调整为%30.
root@caozilong-Vostro-3268:/proc/sys/kernel#
root@caozilong-Vostro-3268:/proc/sys/kernel# cat sched_rt_runtime_us
950000
root@caozilong-Vostro-3268:/proc/sys/kernel# cat sched_rt_period_us
1000000
root@caozilong-Vostro-3268:/proc/sys/kernel# echo 300000 > sched_rt_runtime_us
root@caozilong-Vostro-3268:/proc/sys/kernel# cat sched_rt_runtime_us
300000
root@caozilong-Vostro-3268:/proc/sys/kernel# cat sched_rt_period_us
1000000
root@caozilong-Vostro-3268:/proc/sys/kernel#
PC为4核,所以运行四次,可见CPU占用率稳定在 %30,还有四核有8个a.out在运行,是因为测试程序中创建了两个线程,一个主线程和一个实时线程,四个CPU运行四个最高优先级的线程同时存在,它们共同瓜分了%30的CPU占用率。
dmesg调试输出:
[ 152.226547] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 152.543163] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 152.543167] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 152.543170] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 152.543172] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 153.143066] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 153.143069] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 153.144062] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 153.144064] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 153.543199] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 153.543203] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 153.543205] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 153.543208] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 154.143035] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 154.144034] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 154.144037] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 154.144040] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 154.149441] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 154.543167] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 154.543172] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 154.543175] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 154.543177] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 155.143008] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 155.143013] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 155.143017] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 155.144005] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 155.161285] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 155.543133] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 155.543136] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 155.543137] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 155.543139] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 156.142976] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 156.143977] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 156.143980] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 156.144977] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 156.543105] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 156.543110] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 156.543112] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 156.543115] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 157.142952] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 157.142956] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 157.142957] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 157.142963] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 157.143961] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 157.146095] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 157.543078] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 157.543082] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 157.543085] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 157.543087] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 158.142923] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 158.143920] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 158.143923] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 158.143925] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 158.543050] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 158.543054] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 158.543057] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 158.543059] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 159.142897] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 159.142902] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 159.142904] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 159.142908] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 159.143894] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 159.543014] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 159.543019] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 159.543022] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 159.543025] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 160.142870] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 160.143866] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 160.143868] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 160.143869] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 160.149752] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 160.542974] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 160.542979] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 160.542981] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 160.542984] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 161.142844] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 161.143839] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 161.143841] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 161.143842] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 161.145291] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 161.542975] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 161.542980] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 161.542982] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 161.542984] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 162.142816] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 162.143816] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 162.143822] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 162.143828] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 162.542968] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 162.542969] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 162.542970] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 162.542971] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 163.142786] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 163.142788] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 163.142789] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 163.143787] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 163.143789] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 163.542915] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 163.542919] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 163.542921] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 163.542924] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 164.142765] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 164.142769] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 164.143760] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 164.143762] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 164.143764] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 164.542892] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 164.542896] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 164.542899] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 164.542901] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 165.142739] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 165.143738] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 165.143744] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 165.143748] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 165.145172] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 165.542856] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 165.542861] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 165.542863] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 165.542866] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 166.142713] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 166.143709] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 166.143711] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 166.143712] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 166.143717] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 166.542839] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 166.542843] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 166.542846] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 166.542848] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 167.142685] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 167.142690] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 167.143683] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 167.143686] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 167.143688] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 167.542809] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 167.542813] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 167.542816] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 167.542818] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 168.142659] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 168.143657] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 168.143659] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 168.143662] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 168.542759] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 168.542763] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 168.542766] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 168.542768] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 169.142636] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 169.142641] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 169.142645] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 169.143633] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 169.143635] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 169.542701] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 169.542704] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 169.542706] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 169.542708] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 170.142611] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 170.142614] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 170.143607] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 170.143609] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 170.542734] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 170.542738] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 170.542741] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 170.542743] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 171.142586] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 171.142590] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 171.143582] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 171.143584] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 171.370686] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 171.542852] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 171.542859] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 171.542862] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 171.542866] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 172.142562] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 172.143556] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 172.143558] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 172.144557] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 172.542764] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 172.542771] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 172.542775] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 172.542778] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 173.142534] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 173.142539] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 173.143532] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 173.143535] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 173.144533] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 173.542829] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 173.542832] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 173.542833] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 173.542834] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 174.142508] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 174.143507] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 174.143509] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 174.143510] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 174.143512] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 174.542628] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 174.542635] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 174.542639] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 174.542642] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 175.142485] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 175.142980] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 175.143482] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 175.143484] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 175.542645] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 175.542650] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 175.542651] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 175.542652] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 176.142458] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 176.142460] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 176.142932] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 176.143458] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 176.143460] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 176.542754] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 176.542757] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 176.542759] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 176.542760] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 177.142433] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 177.143433] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 177.143435] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 177.144435] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 177.542730] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 177.542732] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 177.542734] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 177.542735] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 178.142409] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 178.142411] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 178.143409] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 178.143413] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 178.144410] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 178.542679] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 178.542687] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 178.542690] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 178.542694] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 179.142390] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 179.143385] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 179.143387] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 179.143388] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 179.152966] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 179.542655] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 179.542663] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 179.542667] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 179.542670] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 180.142364] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 180.143361] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 180.143363] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 180.144362] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 180.326704] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 180.542629] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 180.542636] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 180.542639] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 180.542642] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 181.142342] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 181.143337] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 181.143338] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 181.143340] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 181.542606] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 181.542613] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 181.542617] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 181.542620] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 182.142315] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 182.143159] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 182.143313] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 182.143315] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 182.542609] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 182.542612] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 182.542613] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 182.542614] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 183.142289] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 183.143289] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 183.143290] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 183.143291] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 183.144289] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 183.542584] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 183.542587] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 183.542588] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 183.542589] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 184.143265] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 184.143267] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 184.143269] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 184.143270] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 184.190872] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 184.542335] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm kworker/1:0.rq_rq = 00000000d110e197
[ 184.542338] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm kworker/1:0.rq_rq = 000000009dc5f730
[ 184.542340] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm kworker/1:0.rq_rq = 000000007cc53a4d
[ 184.542342] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm kworker/1:0.rq_rq = 00000000b2e03ff9
[ 185.142246] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 185.142249] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 185.143241] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 185.143243] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 185.542370] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 185.542374] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 185.542377] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 185.542379] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 186.142222] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 186.143217] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 186.143219] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 186.143220] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 186.143223] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 186.542350] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 186.542352] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 186.542354] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 186.542355] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 187.142194] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 187.142197] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 187.142807] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 187.143194] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 187.143874] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 187.542324] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 187.542327] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 187.542329] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 187.542330] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 188.142173] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 188.143172] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 188.143175] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 188.143178] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 188.542304] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 188.542309] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 188.542312] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 188.542314] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 189.142149] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 189.143146] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 189.143148] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 189.143151] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 189.143151] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 189.542277] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 189.542281] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 189.542284] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 189.542286] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 190.142126] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 190.142131] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 190.142135] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 190.143123] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 190.542250] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 190.542254] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 190.542257] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 190.542259] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 191.142104] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 191.142108] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 191.143102] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 191.143108] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 191.143112] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 191.542202] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 191.542206] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 191.542209] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 191.542212] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 192.142079] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 192.142084] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 192.143075] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 192.143077] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 192.542202] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 192.542207] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 192.542209] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 192.542211] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 193.142056] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 193.142060] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 193.142061] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 193.143051] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 193.143054] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 193.542125] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 193.542128] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 193.542131] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 193.542133] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 194.142033] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 194.143028] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 194.143030] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 194.143032] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 194.143034] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 194.542155] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 194.542159] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 194.542162] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 194.542164] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 195.142009] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 195.143008] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 195.143014] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 195.143017] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 195.542130] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 195.542135] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 195.542138] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 195.542140] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 196.141985] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 196.141989] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 196.141992] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 196.142981] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 196.142983] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 196.542110] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 196.542114] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 196.542117] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 196.542119] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 197.141961] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 197.142956] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 197.142958] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 197.142959] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 197.157030] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
[ 197.542083] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000d110e197
[ 197.542087] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000009dc5f730
[ 197.542089] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 000000007cc53a4d
[ 197.542091] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/1.rq_rq = 00000000b2e03ff9
[ 198.141929] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000d110e197
[ 198.142925] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 00000000b2e03ff9
[ 198.142927] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000007cc53a4d
[ 198.142928] sched_rt_runtime_exceeded line 947, throttled set to one, comm a.out.pree is 0.rq_rq = 000000009dc5f730
[ 198.155381] pick_next_task_rt line 1599. comm (efault), pick next is null, throttled.
继续修改补丁,加入调试信息:
diff --git a/linux-5.4.138/kernel/sched/rt.c b/linux-5.4.138/kernel/sched/rt.c
index 1e102783d..e17c8c126 100644
--- a/linux-5.4.138/kernel/sched/rt.c
+++ b/linux-5.4.138/kernel/sched/rt.c
@@ -944,7 +944,8 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
*/
if (likely(rt_b->rt_runtime)) {
printk_deferred_once("sched: RT throttling activated\n");
- printk("%s line %d, throttled set to one, comm %s.pree is %d.rq_rq = %p\n", __func__, __LINE__, current->comm, rt_rq->rt_throttled, rt_rq);
+ printk("%s line %d, throttled set to one, comm %s.pree is %d.rq_rq = %p, runtime %lld, rt_b->rt_runtime %lld.\n", \
+ __func__, __LINE__, current->comm, rt_rq->rt_throttled, rt_rq, runtime, rt_b->rt_runtime);
rt_rq->rt_throttled = 1;
} else {
/*
@@ -1022,6 +1023,7 @@ dequeue_top_rt_rq(struct rt_rq *rt_rq)
sub_nr_running(rq, rt_rq->rt_nr_running);
rt_rq->rt_queued = 0;
+ printk("%s line %d, rt_queued is zero, running %d.\n", __func__, __LINE__, rt_rq->rt_nr_running);
}
@@ -1041,6 +1043,7 @@ enqueue_top_rt_rq(struct rt_rq *rt_rq)
if (rt_rq->rt_nr_running) {
add_nr_running(rq, rt_rq->rt_nr_running);
rt_rq->rt_queued = 1;
+ printk("%s line %d, rt_queued is set, running %d.\n", __func__, __LINE__, rt_rq->rt_nr_running);
}
/* Kick cpufreq (see the comment in kernel/sched/sched.h). */
DMESG如下:
[ 100.178789] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 0000000085a6961a, runtime 399454500, rt_b->rt_runtime 200000000.
[ 100.178791] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 100.180782] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 000000001a082ea0, runtime 400545479, rt_b->rt_runtime 200000000.
[ 100.180783] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 100.779333] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 0000000085a6961a
[ 100.779335] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 100.779338] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 000000001a082ea0
[ 100.779340] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 101.178807] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 0000000085a6961a, runtime 399405701, rt_b->rt_runtime 200000000.
[ 101.178809] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 101.180805] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 000000001a082ea0, runtime 400594278, rt_b->rt_runtime 200000000.
[ 101.180807] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 101.779342] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 0000000085a6961a
[ 101.779346] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 101.779349] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 000000001a082ea0
[ 101.779351] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 102.178824] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 0000000085a6961a, runtime 399487449, rt_b->rt_runtime 200000000.
[ 102.178826] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 102.180818] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 000000001a082ea0, runtime 400512530, rt_b->rt_runtime 200000000.
[ 102.180819] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 102.180820] pick_next_task_rt line 1602. comm (efault), pick next is null, throttled.
[ 102.779367] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 0000000085a6961a
[ 102.779370] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 102.779373] do_sched_rt_period_timer line 873, throttled is 1, set to zero, comm swapper/3.rq_rq = 000000001a082ea0
[ 102.779374] enqueue_top_rt_rq line 1046, rt_queued is set, running 1.
[ 103.178840] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 0000000085a6961a, runtime 399455905, rt_b->rt_runtime 200000000.
[ 103.178842] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
[ 103.180838] sched_rt_runtime_exceeded line 948, throttled set to one, comm a.out.pree is 0.rq_rq = 000000001a082ea0, runtime 400544074, rt_b->rt_runtime 200000000.
[ 103.180840] dequeue_top_rt_rq line 1026, rt_queued is zero, running 1.
确认线程的优先级
修改用例,增加在设置优先级失败时的打印输出:
#include <string.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <errno.h>
void *child_thread(void *arg)
{
int policy = 0;
int max_priority = 0,min_priority = 0;
struct sched_param param;
pthread_attr_t attr;
struct sched_param sp;
bzero((void*)&sp, sizeof(sp));
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);
pthread_attr_getinheritsched(&attr,&policy);
if(policy == PTHREAD_EXPLICIT_SCHED){
printf("Inheritsched:PTHREAD_EXPLICIT_SCHED\n");
}
if(policy == PTHREAD_INHERIT_SCHED){
printf("Inheritsched:PTHREAD_INHERIT_SCHED\n");
}
pthread_attr_setschedpolicy(&attr,SCHED_RR);
//pthread_attr_setschedpolicy(&attr,SCHED_OTHER);
pthread_attr_getschedpolicy(&attr,&policy);
if(policy == SCHED_FIFO){
printf("Schedpolicy:SCHED_FIFO\n");
}
if(policy == SCHED_RR){
printf("Schedpolicy:SCHED_RR\n");
}
if(policy == SCHED_OTHER){
printf("Schedpolicy:SCHED_OTHER\n");
}
max_priority = sched_get_priority_max(policy);
min_priority = sched_get_priority_min(policy);
printf("Maxpriority:%u\n",max_priority);
printf("Minpriority:%u\n",min_priority);
param.sched_priority = max_priority;
pthread_attr_setschedparam(&attr,¶m);
sp.sched_priority = 20;
// Actually set the sched params for the current thread.
if (0 == pthread_setschedparam(pthread_self(), policy, &sp)) {
printf("IO Thread #%ld using high-priority scheduler!", pthread_self());
}
else
{
printf("set policy and priority error, error str:%s.\n", strerror(errno));
}
printf("sched_priority:%u\n",param.sched_priority);
while(1);
pthread_attr_destroy(&attr);
}
int main(int argc,char *argv[ ])
{
pthread_t child_thread_id;
pthread_create(&child_thread_id,NULL,child_thread,NULL);
pthread_join(child_thread_id,NULL);
return 0;
}
运行如下:
可见, 只有在ROOT模式下,线程才能自己修改优先级,非ROOT模式下,修改优先级失败,我们通过/proc/PID/sched节点分析一下是为什么?
默认情况下,/proc/PID/sched节点不能存在,我们需要打开配置CONFIG_SCHED_DEBUG,使能这个节点。
直接在终端中输入a.out启动,节点输出如下,可以看到它的调度策略为0,也就是CFS调度器。
caozilong@caozilong-Vostro-3268:/proc/2543/task$ cat ./*/sched
a.out (2543, #threads: 2)
-------------------------------------------------------------------
se.exec_start : 220814.476995
se.vruntime : 81140.003578
se.sum_exec_runtime : 1.274267
se.nr_migrations : 0
nr_switches : 1
nr_voluntary_switches : 1
nr_involuntary_switches : 0
se.load.weight : 1048576
se.runnable_weight : 1048576
se.avg.load_sum : 46810
se.avg.runnable_load_sum : 46810
se.avg.util_sum : 23994811
se.avg.load_avg : 1023
se.avg.runnable_load_avg : 1023
se.avg.util_avg : 512
se.avg.last_update_time : 220814476288
se.avg.util_est.ewma : 128
se.avg.util_est.enqueued : 513
policy : 0
prio : 120
clock-delta : 15
a.out (2544, #threads: 2)
-------------------------------------------------------------------
se.exec_start : 311296.113378
se.vruntime : 224487.840094
se.sum_exec_runtime : 90473.692638
se.nr_migrations : 0
nr_switches : 8407
nr_voluntary_switches : 0
nr_involuntary_switches : 8407
se.load.weight : 1048576
se.runnable_weight : 1048576
se.avg.load_sum : 46828
se.avg.runnable_load_sum : 46828
se.avg.util_sum : 47969386
se.avg.load_avg : 1024
se.avg.runnable_load_avg : 1024
se.avg.util_avg : 1024
se.avg.last_update_time : 311296112640
se.avg.util_est.ewma : 0
se.avg.util_est.enqueued : 0
policy : 0
prio : 120
clock-delta : 12
caozilong@caozilong-Vostro-3268:/proc/2543/task$
可以看到,线程的policy仍然是0,表示使用的是CFS调度器。但是当执行
sudo nice -19 ./a.out
时,进程的调度信息如下:
caozilong@caozilong-Vostro-3268:/proc/2579/task$ cat ./*/sched
a.out (2579, #threads: 2)
-------------------------------------------------------------------
se.exec_start : 348024.130905
se.vruntime : 28179.488996
se.sum_exec_runtime : 1.029066
se.nr_migrations : 0
nr_switches : 1
nr_voluntary_switches : 1
nr_involuntary_switches : 0
se.load.weight : 15360
se.runnable_weight : 15360
se.avg.load_sum : 47409
se.avg.runnable_load_sum : 47409
se.avg.util_sum : 23847550
se.avg.load_avg : 15
se.avg.runnable_load_avg : 15
se.avg.util_avg : 498
se.avg.last_update_time : 348024130560
se.avg.util_est.ewma : 124
se.avg.util_est.enqueued : 499
policy : 0
prio : 139
clock-delta : 24
a.out (2580, #threads: 2)
-------------------------------------------------------------------
se.exec_start : 399173.536460
se.vruntime : 0.000000
se.sum_exec_runtime : 51149.405555
se.nr_migrations : 0
nr_switches : 0
nr_voluntary_switches : 0
nr_involuntary_switches : 0
se.load.weight : 15360
se.runnable_weight : 15360
se.avg.load_sum : 47451
se.avg.runnable_load_sum : 47451
se.avg.util_sum : 11420208
se.avg.load_avg : 15
se.avg.runnable_load_avg : 15
se.avg.util_avg : 240
se.avg.last_update_time : 348024173568
se.avg.util_est.ewma : 0
se.avg.util_est.enqueued : 0
policy : 2
prio : 98
clock-delta : 22
caozilong@caozilong-Vostro-3268:/proc/2579/task$
对应的内核打印逻辑是这里
可以看到,进程a.out创建的连个线程,调度策略分别是CFS和SCHED_RR,创建实时线程生效,印证了必须要在ROOT模式下设置线程优先级才可以成功的猜测。
policy各个值表示的意义如下:
0:SCHED_OTHER
1: SCHED_FIFO
2: SCHED_RR
所以,要想实验生效,我们需要在ROOT模式下运行测试用例,更进一步,命令中的renice没有必要加,之前做实验之所以加是根据一片文章的做法,但实际测试发现,直接执行sudo ./a.out,测试仍然有效,所以关键在sudo ROOT用户。
总结:
根据以上LOG和分析,我们可以得出结论如下:
1.4核有4个struct rq_rq队列,每一个核有一个,相应的有四个throttled变量。
2.throttled的置位逻辑在函数sched_rt_runtime_exceeded中进行,它的判断依据就是上面配置的sched_rt_runtime_us节点信息
3.throttled变量的复位发生在do_sched_rt_period_timer函数中,它是根据当前RT线程的占用率情况,如果占用率小于阀值,则复位throttled,允许调度RT线程,根据当前任务名为swapper即可知道,这个函数是在中断上下文中运行,中断打断了idle线程,使能RT线程执行。
4.throttled最终会影响到pick_next_task_rt的选择逻辑,当throttled被置位后,会导致pick_next_task_rt范围空的task_struct指针,这个时候,调度器将不会调度RT类的线程执行。
拓展:
下面是Linux内核实现中的一小段代码:
从上面代码中我们知道,当进程为实时进程时,prio 的值由实时优先级值(rt_priority)计算得来;当进程为非实时进程时,prio 的值由静态优先级值(static_prio)得来。即:
/进程为实时进程时:
prio = MAX_RT_PRIO - 1 - rt_priority
进程为非实时进程时:
prio = static_prio
简单计算上面的两个式子,可以知道,prio 值的范围是 0 ~ 139 ,prio即是动态优先级,prio 的值是调度器最终使用的优先级数值,即调度器选择一个进程时实际选择的值。prio 值越小,表明进程的优先级越高。prio 值的取值范围是 0 ~ MAX_PRIO,即 0 ~ 139(包括 0 和 139),根据调度策略的不同,又可以分为两个区间,其中区间 0 ~ 99 的属于实时进程,区间 100 ~139 的为非实时进程。用语言不好描述,我们通过内核代码来详细描述 prio
关于这个逻辑,我们可以验证如下:
对应的task_struct->prio为100-1-20=79
参考文章:http://www.uml.org.cn/embeded/201904153.asp