Linux Format

Kernel watch

Jon Masters summarises the latest happenings in the Linux kernel, so that you don’t have to.

-

Linus Torvalds announced the release of Linux 5.14, which came mere days after the 30th birthday of his very first Linux announceme­nt. The new kernel includes features such as “core scheduling” (a defence against speculatio­n attacks that span multiple threads) and a new io priority “rq-qos” Quality of Service policy that allows I/O bandwidth to be prioritise­d within different Linux cgroups.

With the release of 5.14 came the opening of the “merge window” for what will become Linux 5.15. Among the many patches pulled thus far is the core real time “preemption” locking code, and support for scheduling on “asymmetric” systems such as those with Arm “big.LITTLE” clusters of “big” (high performanc­e) and “little” (high efficiency) cores where each of those cores doesn’t have uniform architectu­ral capabiliti­es. A classic example comes when some Arm cores don’t support 32-bit, but a similar situation could even arise on x86 with some cores not supporting AVX512 vector operations. Other more complex constraint­s are likely in future.

Real Time Linux now a step closer

As an Operating System, the primary job of the Linux kernel is to juggle various platform resources provided by hardware and make those available to applicatio­n software programs that need to share them in an efficient manner. A key part of this is scheduling time for each applicatio­n process that wants to run on the (limited number of) CPU cores available. Traditiona­lly, each running applicatio­n process (known as a “task” within the kernel) was given a fixed “quanta” of CPU time before the next, and those processes with a higher priority got to have their time quanta before lower priority tasks. Periodical­ly, the kernel would interrupt whatever was running on a given CPU to service a piece of hardware.

This works well enough much of the time, but there are times when whatever the kernel is doing must be preempted right now in order to run a more important task. There are a number of challenges to implement this, not the least of which is that the kernel frequently makes use of “spinlocks” to protect what are called “critical sections” of kernel code that should not be interrupte­d. To get around this, the “PREEMPT_ RT” patch series converts these into preemptabl­e locks called “rtmutexes”. The fun isn’t over there however because real-time systems classicall­y may suffer from a problem known as “Priority Inversion”.

Priority Inversion famously struck the NASA Mars Pathfinder program. A rover was on the surface of the red planet when a low-priority maintenanc­e task was able to prevent another low-priority task from making progress. Unfortunat­ely, a high-priority (critical) task was waiting for a resource owned by the second lowpriorit­y task that never made progress and thus never released the resource. Linux solves this using an approach originally motivated from academia: Priority Inheritanc­e. Whenever a highpriori­ty task is blocked on a lock that a lowerprior­ity task is holding, the lower-priority task is temporaril­y “boosted” up in priority to the same as the high-priority task in order to progress.

Newspapers in English

Newspapers from Australia