<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">Hi,</span><br>
</div>
<div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
I have tried to tweak the kernel scheduler by changing the runtime kernel scheduling sysctl parameter like granularity,latency and i am setting cpu affinity to  CPU 1.</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
I am using perf tool for monitoring the scheduler the different scheduler parameters like runtime,avg-delay.</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
i have set,</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<span style="margin:0px">kernel.sched_autogroup_enabled = 1<br>
</span>
<div style="margin:0px">kernel.sched_cfs_bandwidth_slice_us = 5000<br>
</div>
<div style="margin:0px">kernel.sched_child_runs_first = 0<br>
</div>
<div style="margin:0px"><b>kernel.sched_latency_ns = 2000000</b><br>
</div>
<div style="margin:0px">kernel.sched_migration_cost_ns = 500000<br>
</div>
<div style="margin:0px"><b>kernel.sched_min_granularity_ns = 4000000</b><br>
</div>
<div style="margin:0px">kernel.sched_nr_migrate = 32<br>
</div>
<div style="margin:0px">kernel.sched_rr_timeslice_ms = 100<br>
</div>
<div style="margin:0px">kernel.sched_rt_period_us = 1000000<br>
</div>
<div style="margin:0px">kernel.sched_rt_runtime_us = 950000<br>
</div>
<div style="margin:0px">kernel.sched_schedstats = 0<br>
</div>
<div style="margin:0px">kernel.sched_tunable_scaling = 1<br>
</div>
<div style="margin:0px">kernel.sched_util_clamp_max = 1024<br>
</div>
<div style="margin:0px">kernel.sched_util_clamp_min = 1024<br>
</div>
<div style="margin:0px"><b>kernel.sched_wakeup_granularity_ns = 10000000</b><br>
</div>
<span style="margin:0px"></span><br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
I have few concerns about scheduler tweaking</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
1) After tweaking kernel scheduler at which parameter where i should look for so that i can decide my CPU scheduler is performing good or bad???</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
2) i am setting cpu affinty to cpu 1 but i am able to see some migration when my application is running, i am giving following commands</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
$<span style="margin:0px">sudo perf sched record ./thread-workload-benchmark accum 1 unrollaccum8 1<br>
</span><span style="margin:0px"></span></div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
here,thread-work-benchmark is my app and accum 1 is the cpu 1 on which i am spawning workload</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
$ sudo perf sched latency -s max</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<span style="margin:0px">940828.125071 [0001]   s     thread-workload[7386]               0.011      0.000    587.990      R  next: kworker/1:1[25382]      <br>
</span>
<div style="margin:0px">  940828.125076 [0001]   s     kworker/1:1-eve[25382]            587.990      1.489      0.005      K  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.135578 [0001]    m      thread-workload[7386]                                            migrated: kworker/u8:1-ev[6803] cpu 2 => 3<br>
</div>
<div style="margin:0px">  940828.135584 [0001]         thread-workload[7386]                                            awakened: kworker/u8:1-ev[6803]<br>
</div>
<div style="margin:0px">  940828.135609 [0001]         thread-workload[7386]                                            awakened: systemd[1]<br>
</div>
<div style="margin:0px">  940828.135626 [0001]         thread-workload[7386]                                            awakened: Xorg[32003]<br>
</div>
<div style="margin:0px">  940828.205068 [0001]         thread-workload[7386]                                            awakened: kworker/1:1-eve[25382]<br>
</div>
<div style="margin:0px">  940828.209065 [0001]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px">  940828.209069 [0001]   s     thread-workload[7386]               0.005      0.000     83.992      R  next: kworker/1:1[25382]      <br>
</div>
<div style="margin:0px">  940828.209076 [0001]   s     kworker/1:1-eve[25382]             83.992      4.001      0.007      K  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.343223 [0001]    m      thread-workload[7386]                                            migrated: TeamViewer_Desk[6579/6576] cpu 1 => 2<br>
</div>
<div style="margin:0px">  940828.343227 [0001]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6579/6576]<br>
</div>
<div style="margin:0px">  940828.365067 [0001]         thread-workload[7386]                                            awakened: kworker/1:1-eve[25382]<br>
</div>
<div style="margin:0px">  940828.369067 [0001]   s     thread-workload[7386]               0.007      0.000    159.990      R  next: kworker/1:1[25382]      <br>
</div>
<div style="margin:0px">  940828.369074 [0003]      m    swapper                                                          migrated: thread-workload[7386] cpu 1 => 3<br>
</div>
<div style="margin:0px">  940828.369079 [0003]     i   <idle>                              0.021      0.000      3.983      I  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.370626 [0003]         thread-workload[7386]                                            awakened: teamviewerd[1895/1891]<br>
</div>
<div style="margin:0px">  940828.371479 [0003]      m    thread-workload[7386]                                            migrated: TeamViewer_Desk[6585/6576] cpu 3 => 0<br>
</div>
<div style="margin:0px">  940828.371482 [0003]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6585/6576]<br>
</div>
<div style="margin:0px">  940828.373500 [0003]      m    thread-workload[7386]                                            migrated: TeamViewer_Desk[6576] cpu 3 => 1<br>
</div>
<div style="margin:0px">  940828.373503 [0003]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6576]<br>
</div>
<div style="margin:0px">  940828.398184 [0003]      m    thread-workload[7386]                                            migrated: Timer[5210/5197] cpu 3 => 0<br>
</div>
<div style="margin:0px">  940828.398188 [0003]         thread-workload[7386]                                            awakened: Timer[5210/5197]<br>
</div>
<div style="margin:0px">  940828.416132 [0003]      m    thread-workload[7386]                                            migrated: TeamViewer_Desk[6582/6576] cpu 3 => 0<br>
</div>
<div style="margin:0px">  940828.416136 [0003]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6582/6576]<br>
</div>
<div style="margin:0px">  940828.417802 [0003]         thread-workload[7386]                                            awakened: teamviewerd[1897/1891]<br>
</div>
<div style="margin:0px">  940828.493068 [0003]         thread-workload[7386]                                            awakened: kworker/3:2-eve[5907]<br>
</div>
<div style="margin:0px">  940828.497068 [0003]     s   thread-workload[7386]               0.012      0.000    127.988      R  next: kworker/3:2[5907]      <br>
</div>
<div style="margin:0px">  940828.497074 [0001]    m      swapper                                                          migrated: thread-workload[7386] cpu 3 => 1<br>
</div>
<div style="margin:0px">  940828.497080 [0001]   i     <idle>                              0.017      0.000      2.696      I  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.504429 [0001]    m      thread-workload[7386]                                            migrated: TeamViewer_Desk[6576] cpu 1 => 2<br>
</div>
<div style="margin:0px">  940828.504437 [0001]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6576]<br>
</div>
<div style="margin:0px">  940828.509070 [0001]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px">  940828.529068 [0001]         thread-workload[7386]                                            awakened: kworker/u8:1-ev[6803]<br>
</div>
<div style="margin:0px">  940828.529072 [0001]         thread-workload[7386]                                            awakened: kworker/1:1-eve[25382]<br>
</div>
<div style="margin:0px">  940828.533067 [0001]   s     thread-workload[7386]               0.011      0.000     35.987      R  next: kworker/1:1[25382]      <br>
</div>
<div style="margin:0px">  940828.533074 [0001]   s     kworker/1:1-eve[25382]            163.985      3.995      0.006      K  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.537067 [0001]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px">  940828.561067 [0001]         thread-workload[7386]                                            awakened: kworker/1:1-eve[25382]<br>
</div>
<div style="margin:0px">  940828.565071 [0001]   s     thread-workload[7386]               0.006      0.000     31.997      R  next: kworker/1:1[25382]      <br>
</div>
<div style="margin:0px">  940828.565079 [0001]   s     kworker/1:1-eve[25382]             31.997      4.004      0.007      K  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.581067 [0001]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px">  940828.605069 [0001]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px">  940828.625069 [0001]         thread-workload[7386]                                            awakened: kworker/1:1-eve[25382]<br>
</div>
<div style="margin:0px">  940828.629069 [0001]   s     thread-workload[7386]               0.007      0.000     63.990      R  next: kworker/1:1[25382]      <br>
</div>
<div style="margin:0px">  940828.629075 [0003]      m    rcu_sched[11]                                                    migrated: thread-workload[7386] cpu 1 => 3<br>
</div>
<div style="margin:0px">  940828.629080 [0003]     s   rcu_sched[11]                       7.989      0.001      0.014      K  next: thread-workload[7386]  <br>
</div>
<div style="margin:0px">  940828.641063 [0003]      m    thread-workload[7386]                                            migrated: rcu_sched[11] cpu 3 => 1<br>
</div>
<div style="margin:0px">  940828.641065 [0003]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</div>
<div style="margin:0px"> <span> </span><b>940828.644047 [0003]      m    thread-workload[7386]                                            migrated: TeamViewer_Desk[6595/6576] cpu 3 => 0</b><br>
</div>
<div style="margin:0px">  940828.644050 [0003]         thread-workload[7386]                                            awakened: TeamViewer_Desk[6595/6576]<br>
</div>
<div style="margin:0px"> <span> </span><b>940828.657066 [0003]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</b></div>
<div style="margin:0px"><b>  940828.665068 [0003]         thread-workload[7386]                                            awakened: rcu_sched[11]<br>
</b></div>
<div style="margin:0px"><b>  940828.685069 [0003]         thread-workload[7386]                                            awakened: kworker/3:2-eve[5907]<br>
</b></div>
<div style="margin:0px"><b>  940828.689072 [0003]     s   thread-workload[7386]               0.011      0.000     59.992      R  next: kworker/3:2[5907]      <br>
</b></div>
<span style="margin:0px"><b>  940828.689078 [0001]    m      swapper                                                          migrated: thread-workload[7386] cpu 3 => 1</b></span><br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<div style="margin:0px">  </div>
<div style="margin:0px">  </div>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<span style="margin:0px"><br>
</span></div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
Though i have set affinity to cpu1 why it is getting migrated to another cpu like as shown in the report,sometimes it getting migrated to cpu3 or cpu0 ,i am not able to get that..can someone help me to figure it out??</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
Thanks!</div>
<div style="margin:0px; font-size:12pt; font-family:Calibri,Arial,Helvetica,sans-serif; text-align:left; background-color:rgb(255,255,255)">
<br>
</div>
<br>
<br>
</div>
</div>
</div>
</body>
</html>