Member-only story
A patch by Linus Torvalds improved Linux kernel performance by 2.6%.
3 min readNov 28, 2024
There is really no introduction needed to Linus Torvalds founder of Linux and git.
Recently, he did a patch to kernel which saw its performance increased by 2.6%. Let’s see in detail what he did and how does that improve the performance.
This was achieved by optimizing a function called copy_from_user()
, which is responsible for copying data from user space to kernel space.
Here’s a detailed notes:-
- Picture this: You’ve got a super safe door with lots of locks to keep the bad guys out. This is similar to the old code with the barrier_nospec() function — very secure, but it takes time to open.
- Linus Torvalds came up with a smart way to keep the door secure with fewer locks. He used a technique called “pointer masking” which works like a special key that fits in the right lock. This allows the door to open faster while maintaining its security.
- This tiny tweak made the computer roughly 2.6% quicker when handling multiple tasks at once. It’s…