Linux 5.12 Coming In At Around 28.8 Million Lines, AMDGPU Driver Closing In On 3 Million
Written by Michael Larabel in Linux Kernel on 1 March 2021 at 01:25 PM EST. 15 Comments
The Linux kernel source tree following the eventful 5.12 merge window is at 28.81 million lines in the source tree across more than sixty thousand files. The largest in-tree kernel driver continues to be the AMDGPU kernel driver, which in the next kernel release or so should be crossing three million lines.

Linux 5.12's merge window wasn't the biggest in recent time with some 508k lines of code added and 312k lines of code removed, or a net gain of 196k lines. The Linux 5.11 merge window meanwhile saw some 596k lines added and even the Linux 5.10 merge window saw a net gain of some 284k lines. Even so, bit by bit the Linux kernel source tree is closing in on 29 million lines likely to be breached with the Linux 5.13 merge window.

When running cloc on the Linux Git repository as of yesterday, it amounts to some 21,306,743 lines of detected code, another 3,678,576 lines of comments, and 3,833,729 blank lines within the source files. Of the detected code it's some 15.1 million lines while header files are just over five million lines. The cloc measurement reported 60,820 files in the Linux Git source tree as of yesterday.

When talking of the Linux kernel size, it's always fun to take a look at the size of the AMDGPU DRM driver area including its DC, AMDKFD, and related bits that make up their current post-Radeon DRM kernel driver. On that front as of yesterday were 2,499,130 lines of detected code, 288,441 lines of comments, and 117,501 blank lines across 1,585 files. The AMDGPU driver code remains the largest driver in the tree at around 2,905,072 lines for the moment.

While the largest driver in measuring the source code overall, much of AMDGPU is from (auto-generated) header files for GPU registers. Of the 2.49 million lines of code, 2.108 million lines of that is header files. The AMDGPU driver relies on auto-generated header files for GPU registers, much of them go unused albeit not impacting end-users with unused portions being disregarded by the compiler.

Currently at 2.905 million lines, for Linux 5.13 it should cross three million lines for AMDGPU while the kernel source code overall will likely surpass 29 million. On the AMDGPU front, there is at least the new AMD "Aldebaran" CDNA GPU being enabled and as noted that next-gen GFX9 part is 132k lines of new kernel code -- again, most of that being header files -- so assuming Aldebaran lands for Linux 5.13 (it should, given plenty of timing) is enough to bump the AMDGPU kernel driver over the three million mark plus whatever else brews in the weeks ahead.

But enough with the line counts, see our Linux 5.12 feature overview to learn about all the improvements and new features coming to this next kernel version.
Related News
About The Author
Author picture

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter or contacted via

Popular News This Week