How a Tiny Linux Patch Boosted Multithread Performance by 2.6%

Linus Torvalds' recent kernel tweak eliminates a barrier function, improving multithread performance by 2.6% while addressing speculative‑execution vulnerabilities like Meltdown and Spectre, illustrating the trade‑off between speed and security in modern Linux systems.

21CTO
21CTO
21CTO
How a Tiny Linux Patch Boosted Multithread Performance by 2.6%

Linus Torvalds recently made a modest code change that noticeably increased Linux's multithread performance.

The commit, named x86/uaccess , removes the use of barrier_nospec() in the 64‑bit copy_from_user() function, a security adjustment aimed at mitigating the 2018‑disclosed Meltdown and Spectre attacks.

Although these specific mitigations are applied, similar speculative‑execution attacks still persist.

The patch originated from Red Hat developer Josh Poimboeuf; Torvalds rewrote it to enhance speed, noting that the kernel test robot reported a 2.6% improvement in the per_thread_ops benchmark.

By avoiding the barrier_nospec() API, the new code sidesteps mechanisms that manage speculative execution on certain machine instructions.

Speculative execution is a modern multi‑core CPU feature that predicts which code paths will be needed and executes them ahead of time; correct predictions save time, while mispredictions discard results, creating a class of security issues that researchers continue to study.

Instead of allowing copy_from_user() calls with invalid addresses, the updated implementation uses pointer masking to return all addresses safely.

Defending against such attacks is crucial for server‑type workloads, often requiring the disabling of performance‑enhancing features to improve security, a trade‑off Linus Torvalds traditionally opposes.

On personal Linux machines (desktops or laptops), inbound connections are disabled by default; users can disable this restriction to gain better performance if they understand and accept the modest risk.

While not a monumental event, the change highlights why Linus continues to receive over $1 million annually from the Linux Foundation.

Few possess his deep expertise, especially in x86 architecture; most experts work for major chip vendors under non‑disclosure agreements.

Before joining the Linux Foundation, Linus consulted for Transmeta, helping the company develop the Crusoe VLIW chip that emulated x86‑32 code.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

copy_from_userSpeculative ExecutionLinus Torvalds
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.