The road to Zettalinux
The road to Zettalinux
Posted Sep 18, 2022 6:25 UTC (Sun) by willy (subscriber, #9762)In reply to: The road to Zettalinux by zev
Parent article: The road to Zettalinux
One of the defined types is isize/usize which matches the word size of the machine. We'd be a lot better off if more arithmetic inside the kernel were done in isize/usize units instead of just reaching for 'int'.
An example which came up recently is "number of bytes in a page". A lot of code just uses "int", and that works fine until you're on a PowerPC and use a 16GB HugeTLB page. Bam, silent truncation, you lose when trying to access the last 3/4 of the page. Possibly weird behaviour when accessing the 2GB to 4GB region of the page, depending on the exact function you're calling. If we reached for "isize" instead of "int", this wouldn't even be close to a problem.
