Preparing code for 64-bit ARM
Code Cleanup

"maddog" and Linaro are collaborating on a contest to improve the performance of certain GNU/Linux source code modules.
Last month, I wrote briefly about a project I am doing for Linaro, which is an association of ARM processor companies that collaborate to achieve better support for Linux on ARM systems. The original project was to help with approximately 1,400 source code modules in the GNU/Linux system containing assembly language and to make sure these modules were ready for the 64-bit version of ARM processors now appearing from various manufacturers.
Steve McIntyre, a friend of mine who works for ARM directly, lwocated the 1,400 modules and analyzed some for content and difficulty in "porting." Steve has had a lot of expertise with this because he has been a long-time kernel programmer and was the Debian project leader for a while.
Steve noticed that while some of the modules were very good, in some the 32-bit assembly language had been added in a sub-optimal way, not taking advantage of some of the ARM features. In other cases, the assembly language was doing tasks (i.e., identification of hardware) that would be better performed in a compiler "intrinsic," which could then be used by every machine architecture in a consistent way.
As I started to analyze the task, I also realized that some of these modules had been written quite a long time ago, and although they had been maintained – with bugs fixed and ports done – the underlying design was for smaller, more expensive memory and slower single-core processors. Likewise, Steve only analyzed the source code of the module. He did not look at the compiler options used in the build of the software. In some cases, the flags used on the compiler did not take advantage of the newer optimizations of the compilers.
Taking larger and cheaper memory into account, as well as multicore processors, it is possible that code that was very efficient 10 years ago could use some analysis and performance improvements today.
After talking with the Linaro association, I decided to turn the "porting project" into a "performance contest" to see if we could get some performance improvement out of these modules.
For example, Digital Equipment Corporation (DEC) has a very good math library into which we had invested a lot of money. DEC was willing to contribute the binary to the Alpha/Linux project for free but refused to expose the source code of the library for fear that their competitors would simply copy it. Of course, the GNU/Linux community wanted the source code, and they hounded me for it.
Eventually, I replied, "If you are such good programmers, write a better math library." Three or four days later, an email announced that the sin(3)
function was "2% faster" and later cos(3)
was "1.5% faster." Day by day, the FOSS people changed the source code of the math library to make each and every subroutine faster than the one in the DEC proprietary code. Only one subroutine was never written to execute faster, and that was because no one used it … no one cared.
A second example was a reduction of memory footprint for the DEC UNIX (née OSF/1) operating system that allowed it to boot and run in 32MB of main memory instead of 64MB (yes, you read that correctly). After the work on it, the OS not only ran in less memory, it ran 7% faster on the same hardware because of better cache utilization simply by reducing code size and improving how the cache was used.
Therefore, I am starting a contest not only to ensure GNU/Linux code works on a 64-bit system, but also to see how much we can improve the performance and maintainability of the code in various ways.
Linaro has agreed to be the main sponsor of this contest to improve the code. They will identify potential code candidates and ask the contestants to measure code performance before and after modification. We will ask participants to document their work on the code and the algorithms they might have considered and changed and why. And, of course, we will be working with the upstream developers and module maintainers to make sure the improvements are acceptable.
We also will be looking for people to write various compiler intrinsics and make them available to the FOSS community, and we will be looking for mentors and judges. Finally, we will take the output of this contest and publish it. I hope to gather enough material for a course in code optimization that will be freely available.
I don't have enough room here to explain all the rules and options for this contest, so I will cover those issues online in my blog [1].
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Direct Download
Read full article as PDF:
Price $2.95
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
Kubuntu Focus Announces XE Gen 2 Linux Laptop
Another Kubuntu-based laptop has arrived to be your next ultra-portable powerhouse with a Linux heart.
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.
-
openSUSE Leap 15.5 Beta Now Available
The final version of the Leap 15 series of openSUSE is available for beta testing and offers only new software versions.
-
Linux Kernel 6.2 Released with New Hardware Support
Find out what's new in the most recent release from Linus Torvalds and the Linux kernel team.