I am trying to understand the working of the Linux CFS scheduler using kernel version 4.19.2.
As mentioned in the documentation, it does not use timeslices in the traditional way but uses the concept of virtual runtime. The update to this vruntime for every process is made in the file kernel/sched/fair.c
The exact line for the update is
curr->vruntime += calc_delta_fair(delta_exec, curr); //curr is the currently scheduled task, the function cal_delta_fair() returns a value depending on the duration the task ran and its priority ensuring fairness.
The variable vruntime is u64, defined in the kernel types as unsigned integer of 64B. To understand how the vruntime varies for a process, I wrote a system call to get it's value out, which turned out to be negative as well as positive at times. How? What does a negative value for vruntime signify?