I am writing one application with openmp on a Arm based system. In which I am having 4 High Performance core (Arm Cortex A57) and 4 Low Performance core (Arm Cortex A53).
Environment: Poky (Yocto Project Reference Distro) 2.4.3
#pragma omp parallel sections num_threads(3)
{
#pragma omp section
{
cpu_set_t cpu_mask;
CPU_ZERO(&cpu_mask);
CPU_SET(4, &cpu_mask);
sched_setaffinity((pid_t) 0, sizeof(cpu_mask), &cpu_mask);
while (true) {
// Capturing Image Here
}
}
#pragma omp section
{
#pragma omp parallel num_threads(4)
{
cpu_set_t cpu_mask;
CPU_ZERO(&cpu_mask);
CPU_SET(omp_get_thread_num(), &cpu_mask);
sched_setaffinity((pid_t) 0, sizeof(cpu_mask), &cpu_mask);
while (true) {
// Processing Captured Image
}
}
}
In above code 1st section is used to capture Video Frames from V4L2 and filling to buffer which is mapped to Low end core CPU4, and In 2nd Section Spanning 4 threads and mapping to High end cores (0-3) Respectively.
When I am running the application, giving proper performance until any of the high end core is being used by background task or kernel operation. Is there any way to block other task to use CPU 0-3?
Please feel free to correct me if I am analysing in wrong manner.