- Posts: 71
- Thank you received: 0
Howto schedule realtime tasks to CPU1 when isolcpus=1
9 years 9 months ago #86540
by DomCa
Howto schedule realtime tasks to CPU1 when isolcpus=1 was created by DomCa
Hi all,
as I mentioned in my other thread I installed LinuxCNC on Lubunut. I am now down to a max latency of 13000, which seems ok to me for a start. The PC is an Athlon64 X2 (dual core)
However I noticed one thing:
All threads are on CPU0 when I use the isolcpus=1 parameter. Nothing is on CPU1.
Wouldn't it make sense to run the realtime threads on the CPU1?
Is this possible?
Thanks
Domca
as I mentioned in my other thread I installed LinuxCNC on Lubunut. I am now down to a max latency of 13000, which seems ok to me for a start. The PC is an Athlon64 X2 (dual core)
However I noticed one thing:
All threads are on CPU0 when I use the isolcpus=1 parameter. Nothing is on CPU1.
Wouldn't it make sense to run the realtime threads on the CPU1?
Is this possible?
Thanks
Domca
Please Log in to join the conversation.
9 years 9 months ago #86542
by ArcEye
I can only suggest you read what isol(ate)cpus does and why it is used.
Short answer NO
The reason you are getting 13K max jitter, is because they are NOT spread across 2 core caches.
Replied by ArcEye on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
However I noticed one thing:
All threads are on CPU0 when I use the isolcpus=1 parameter. Nothing is on CPU1.
Wouldn't it make sense to run the realtime threads on the CPU1?
I can only suggest you read what isol(ate)cpus does and why it is used.
Short answer NO
The reason you are getting 13K max jitter, is because they are NOT spread across 2 core caches.
Please Log in to join the conversation.
9 years 9 months ago #86546
by DomCa
Replied by DomCa on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Hi!
I know that isolcpus prevents the scheduler from using the isolated CPUs.
But wouldn't it make sense to run the realtime part (and only that) of linuxcnc on exactly that isolated CPUs?
I know that isolcpus prevents the scheduler from using the isolated CPUs.
But wouldn't it make sense to run the realtime part (and only that) of linuxcnc on exactly that isolated CPUs?
Please Log in to join the conversation.
9 years 9 months ago #86548
by DomCa
Replied by DomCa on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Hi again,
ArcEye: such a NO asks for some experimenting...
I just tried rescheduling single tasks that are spanwed when LinuxCNC is started.
The command:
taskset -p 1 <PID of "milltask">
reduced my latency to under 7000 from 13000
ArcEye: such a NO asks for some experimenting...
I just tried rescheduling single tasks that are spanwed when LinuxCNC is started.
The command:
taskset -p 1 <PID of "milltask">
reduced my latency to under 7000 from 13000
Please Log in to join the conversation.
9 years 9 months ago #86608
by andypugh
I _think_ that is actually what happens. Do you see the realtime task running on the non-isolated CPU?
As far as I recall "top" does not see the isolated cores.
[Edit]
Yes, RTAI knows how to use the isolated CPUs:
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS
Replied by andypugh on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
DomCa wrote: But wouldn't it make sense to run the realtime part (and only that) of linuxcnc on exactly that isolated CPUs?
I _think_ that is actually what happens. Do you see the realtime task running on the non-isolated CPU?
As far as I recall "top" does not see the isolated cores.
[Edit]
Yes, RTAI knows how to use the isolated CPUs:
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS
Please Log in to join the conversation.
9 years 9 months ago #86615
by DomCa
Replied by DomCa on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Hi Andy,
I expected such a behaviour. But htop Shows that all tasks are on CPU 0. In htop you can show the "Processor". According to htop every Task is on CPU 0.
Using taskset you can move single tasks to CPU 1, this is then also reflected in htop (and on my system reduces latency, this is reproducible. But I will perform more tests).
I expected such a behaviour. But htop Shows that all tasks are on CPU 0. In htop you can show the "Processor". According to htop every Task is on CPU 0.
Using taskset you can move single tasks to CPU 1, this is then also reflected in htop (and on my system reduces latency, this is reproducible. But I will perform more tests).
Please Log in to join the conversation.
9 years 8 months ago #88498
by DomCa
Replied by DomCa on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Hi again,
since nothing is run on the isolated CPUs at all, I suppose that LinuxCNC does not implement the instructions in section 2. of
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS
2. IsolCpuMask in RTAI
Then what you have to do on the RTAI side is to load the core RTAI HAL module
using something like: "insmod rtai_hal.ko IsolCpusMask=<xxx>", where <xxx>
is the mask of isolated CPUs. Please notice that Linux uses a list if isolated
CPUs while RTAI requires the corresponding mask (I'm lazy and let you do it).
Is there any way to add the IsolCpusMark=XXX to the loading of the rtai_hal.ko?
Thanks
DomCa
since nothing is run on the isolated CPUs at all, I suppose that LinuxCNC does not implement the instructions in section 2. of
github.com/ShabbyX/RTAI/blob/master/README.ISOLCPUS
2. IsolCpuMask in RTAI
Then what you have to do on the RTAI side is to load the core RTAI HAL module
using something like: "insmod rtai_hal.ko IsolCpusMask=<xxx>", where <xxx>
is the mask of isolated CPUs. Please notice that Linux uses a list if isolated
CPUs while RTAI requires the corresponding mask (I'm lazy and let you do it).
Is there any way to add the IsolCpusMark=XXX to the loading of the rtai_hal.ko?
Thanks
DomCa
Please Log in to join the conversation.
9 years 8 months ago #88511
by Bari
Replied by Bari on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Linuxcnc runs RTAI on an isolated cpu. It does so by default and
you don't have to use isolcpus=x for the past few years.
Use this tree and RTAI will work with Linuxcnc:
github.com/NTULINUX/RTAI
you don't have to use isolcpus=x for the past few years.
Use this tree and RTAI will work with Linuxcnc:
github.com/NTULINUX/RTAI
Please Log in to join the conversation.
9 years 8 months ago #88534
by DomCa
Replied by DomCa on topic Howto schedule realtime tasks to CPU1 when isolcpus=1
Hi Bari,
thank you for pointing out the RTAI tree. I will test it as soon as possible.
With the standard install from the live CD all tasks (non-realtime and real-time) are scheduled on the non-isolated CPU, at least on my system.
Should the Live-CD be modified to include the NTULINUX tree?
Thanks
DomCa
thank you for pointing out the RTAI tree. I will test it as soon as possible.
With the standard install from the live CD all tasks (non-realtime and real-time) are scheduled on the non-isolated CPU, at least on my system.
Should the Live-CD be modified to include the NTULINUX tree?
Thanks
DomCa
Please Log in to join the conversation.
Time to create page: 0.134 seconds
