I want to create two kernels for the Raspberry Pi 3. One running all the processes with only the SCHED_FIFO policy, the second running the processes with only the SCHED_RR policy.

Can somebody help me with the function's modifications I must do in the source code of Raspbian Kernel 4.9? I am totally new to this field.

According to my survey, the changes have to be done in the sched_fork and the _sched_setscheduler functions in kernel/sched/core.c but I am confused about which thing to touch here.


A possible solution is outlined here: https://aelseb.wordpress.com/2016/01/06/change-linux-cpu-default-scheduler/

+     /* Lorenzo Nava: force policy to RR */
+     if (p->policy == SCHED_NORMAL) {
+         p->prio = current->normal_prio - NICE_WIDTH -
+                 PRIO_TO_NICE(current->static_prio);
+         p->normal_prio = p->prio;
+         p->rt_priority = p->prio;
+         p->policy = SCHED_RR;
+         p->static_prio = NICE_TO_PRIO(0);
+     }

+     /* Lorenzo Nava: force policy of process to RR */
+     if (attr.sched_policy == SCHED_NORMAL) {
+         attr.sched_priority = param->sched_priority -
+                 NICE_WIDTH - attr.sched_nice;
+         attr.sched_policy = SCHED_RR;
+     }

It still applies to the Kernel 4.12 which I am currently using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.