3 ms·
I’m not familiar with the code. But my assumption is that it’s not that they chose to use an 8 bit integer for the y-version field. It’s that they chose to use
by josephg 6y ago
I’m not familiar with the code. But my assumption is that it’s not that they chose to use an 8 bit integer for the y-version field. It’s that they chose to use a 24-bit number for the whole version. OxXXYYZZ - Eg 0x050801 for kernel version 5.8.1. That lets you compare kernel version A with kernel version B using a simple u32 cmp. They could have used 16 bits per version field - but that would have needed a 64 bit integer, which is much slower on some of the systems Linux used to run on back when that decision was made. In retrospect that was a bad choice, but I’m sure it seemed fine in the 90s.
The problem is that if they spill the minor version to 16 bits (xxyyyyzz) then kernel version 4.256.1 is “newer than” kernel 5.8.1 - because 0x04010001 > 0x00050801. And that’s a compatibility breaking change.
- scns 6y agoSorry for nitpicking, the problem from the article is about the patch number. Your reasoning is still holds though: 0x00050801 (5.8.1 8b for patch) < 0x04090100 (4.9.256 16b for patch)
- josephg 6y agoOh oops - thanks for the correction! I somehow misread the article to be talking about 4.256.x instead of 4.x.256.