Skip to content
hellsgodPublic

About

hC for Arch Linux

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

606 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

linux-hC

A personal Linux kernel built for my own use, based on the CachyOS PKGBUILD and a selection of patches from various upstream and community projects.

The goal is to create a responsive and efficient kernel tailored to my hardware and preferences, rather than a general-purpose kernel intended for everyone.

This repository is primarily maintained for my personal use. I make it publicly available for anyone interested in experimenting with it.

About

linux-hC and linux-hC-rc use a modified version of the CachyOS PKGBUILD.

I integrate selected patches and optimizations from projects such as ZEN, CachyOS, Clear Linux, XanMod, pf-kernel, and independent kernel developers.

My kernel source repository contains separate branches for each kernel version, where I maintain the changes included in my patch collections, such as base.patch and fixes.patch.

Each change is kept as an individual commit, preserving the original author's attribution and commit message. This allows anyone interested to browse the corresponding branches and see exactly which changes are included, rather than having to dig through large patch files.

The patch files themselves are generated using git diff, as I previously encountered issues with git format-patch during the PKGBUILD build process.

Patches from firelzrd, including BORE, poc-selector, NAP, Cambyses, and lru_cast, are maintained by their original developer and integrated separately.

linux-hC is a personal project, developed primarily for my own use and tailored to my hardware, preferences, and interests.

I enjoy experimenting with different approaches to kernel development, learning from other developers, and sharing ideas and improvements along the way.

I'm happy to make my work publicly available and always appreciate constructive feedback, bug reports, and technical discussions.

However, I prefer to keep this project as a hobby rather than turn it into a community-maintained kernel. Features and patches are selected based on my own interests and requirements, and I don't intend to provide ongoing support or accommodate individual feature requests.

You're welcome to use, modify, and experiment with it to suit your own needs.

Design Philosophy

My goal with linux-hC is not to achieve maximum performance through aggressive tuning or brute-force optimizations, but to make better use of the available hardware by reducing unnecessary overhead and improving efficiency.

I primarily focus on three areas:

  • Responsiveness: Keeping the system responsive and interactive, even under heavy workloads and high CPU utilization.
  • Efficiency: Improving how system resources are managed and utilized, rather than simply pushing the hardware harder.
  • Practical performance: Prioritizing consistent behavior and a smooth everyday experience over synthetic benchmark results.

I prefer targeted changes to scheduling, load balancing, CPU idle behavior, and memory management that fit this approach.

Patches are selected based on their design, potential benefits, and relevance to my own usage. I'm also willing to experiment with newer approaches, even if their benefits are not immediately measurable.

I don't believe that more features necessarily make a better kernel. Instead, I focus on a carefully selected set of changes that serve a clear purpose, rather than including every available tweak or optimization simply because it exists.

Most testing is done through real-world usage, including gaming, multitasking, and compiling large projects under full CPU load. Feedback from other users and different hardware configurations is also valuable.

I do not claim that every modification provides a measurable performance improvement, nor do I aim to outperform other kernels in benchmarks.

Ultimately, linux-hC is about finding a balance between responsiveness, efficiency, and stability that works well for my everyday use.

Kernel Versions

Package Description
linux-hC Stable upstream kernel releases
linux-hC-rc Release candidates and experimental development

Development and support policy:

  • Most development takes place on the RC branch.
  • I generally use the latest release candidate on my own system.
  • When a new kernel series reaches stable, support for the previous stable series is dropped.
  • No LTS versions are maintained.
  • Kernel versions are not necessarily maintained until their upstream EOL.
  • Features are added or removed based on my personal requirements and testing.
  • Compatibility with other hardware configurations is not guaranteed.

This is not intended to be a kernel for everyone.

Features

Scheduling and CPU Management

  • BORE (Burst-Oriented Response Enhancer) — Default scheduler enhancements by Masahito Suzuki. Repository
  • poc-selector — Optimized idle CPU selection. Repository
  • Cambyses — Custom load-balancing optimizations. Repository
  • TEO — Default CPU idle governor instead of menu.
  • NAP — Alternative CPU idle governor, compiled into the kernel but requiring explicit activation through the kernel command line. Repository

Memory Management

  • Selected memory management tweaks from ZEN, including compaction and watermark adjustments.
  • lru_cast — Cost-Aware Self-Tuning LRFU page replacement algorithm. Repository

Compiler and Build Configuration

  • Built using my custom LLVM/Clang 24 toolchain. Repository
  • ThinLTO enabled by default.
  • AutoFDO (Automatic Feedback-Directed Optimization) enabled by default, using workload-specific profiles generated with my hC-AutoFDO tool.
  • Rust support enabled.
  • Additional compiler and build configuration adjustments for my personal setup.

AutoFDO and Workload Profiling

I use AutoFDO to guide compiler optimizations based on actual kernel activity rather than relying exclusively on static compiler heuristics.

Since I regularly compile the Linux kernel and LLVM while continuing to use my desktop for other tasks, I wanted my profiles to reflect more than just compilation workloads. Responsiveness, everyday desktop usage, scheduler activity, and transitions between load and idle are equally important to me.

For this purpose, I developed hC-AutoFDO, a standalone tool that automates workload recording, profile conversion, recording quality analysis, and weighted profile merging.

The profiles included in this repository are collected on my AMD Ryzen 9 9950X.

Available Profiles

I provide two AutoFDO profiles with different workload weightings:

Workload Development Balanced
Linux kernel compilation 46% —
LLVM compilation 29% —
schbench 10% 30%
Desktop workload 15% 70%

Development — hC-development.afdo

This profile reflects my own usage pattern, where compiling large projects is a regular part of my everyday desktop use.

It combines compilation workloads with scheduler activity and simulated desktop usage. The intention is to retain a focus on compilation-heavy workloads without neglecting interactive behavior.

Balanced — hC-balanced.afdo

This profile is intended for systems where compiling large projects is not a primary workload.

It places greater emphasis on everyday desktop usage, multitasking, scheduler activity, and transitions between load and idle.

Both profiles are generated from the same profiling session using different workload weightings. The Balanced profile excludes the compilation recordings entirely.

Profile Selection

I deliberately distinguish between usage patterns rather than hardware classes. A laptop used for software development may benefit from a different profile than a powerful desktop primarily used for browsing, gaming, and everyday tasks.

I do not consider either profile universally superior. They represent different workload priorities, and their actual benefits may vary depending on hardware, kernel configuration, and individual usage.

If neither profile reflects your usage particularly well, you are welcome to use hC-AutoFDO to generate your own profile.

For more information about the profiling process, available presets, workload design, and configuration options, see the hC-AutoFDO repository.

Additional Patches

  • Selected fixes and optimizations from Clear Linux, ZEN, CachyOS, XanMod, and pf-kernel.
  • Various upstream fixes and patches.

The exact patch selection may change between kernel versions.

Building the Kernel

The PKGBUILD is configured for my personal system by default. You should review and adjust the configuration before building it on different hardware.

1. CPU Optimization

Set the following variable in the PKGBUILD:

"${_processor_opt:=zen4}"

Available options:

Option Description
zen4 Optimization settings for Zen 4
native Optimize for the CPU used during compilation
generic More portable configuration for different CPUs

I do not use graysky2's kernel_compiler_patch, so these are the only supported options.

2. LLVM/Clang Configuration

By default, the PKGBUILD uses my custom LLVM/Clang installation.

To use the system LLVM/Clang toolchain instead, set:

"${_custom_llvm=no}"

To use a custom LLVM/Clang installation, enable it:

"${_custom_llvm=yes}"

Then adjust the following paths to match your installation:

"${_custom_llvm_path=/home/hellsgod/clang24/bin}"
"${_custom_libclang_path=/home/hellsgod/clang24/lib}"

The custom libclang path is used for Rust-related build components.

3. AutoFDO Configuration

AutoFDO is enabled by default, using the Development profile generated on my AMD Ryzen 9 9950X.

: "${_autofdo:=yes}"
: "${_autofdo_profile_name:=hC-development.afdo}"

Both the Development and Balanced profiles are included in the repository.

To use the Balanced profile instead, change the profile name in the PKGBUILD:

: "${_autofdo_profile_name:=hC-balanced.afdo}"

After changing the profile, update the source checksums before building the kernel:

updpkgsums

I use the Development profile on my own system because it reflects my compilation-heavy desktop usage. If compiling large projects is not a regular part of your workload, the Balanced profile may be a more appropriate starting point.

Using a Custom Profile

You can also generate your own workload-specific profile using hC-AutoFDO.

Place the generated profile in the same directory as the PKGBUILD and adjust the profile name accordingly:

: "${_autofdo_profile_name:=custom.afdo}"

Important: Whenever you switch profiles or replace an existing profile with a newly generated one, run updpkgsums before building the kernel. Otherwise, the source integrity check will fail.

The updpkgsums command is provided by the pacman-contrib package.

Disabling AutoFDO

If you prefer to build the kernel without AutoFDO, set:

: "${_autofdo:=no}"

The supplied profiles are generated on my own hardware and reflect specific workload patterns. I do not guarantee performance improvements on other hardware configurations or workloads.

4. Build and Install

After reviewing the configuration, build and install the kernel using:

makepkg -si

You can modify the PKGBUILD to enable or disable additional features according to your requirements.

NVIDIA Open Kernel Module

Both linux-hC and linux-hC-rc can compile the NVIDIA open kernel module as part of the kernel build process.

This is enabled by default for my personal setup.

To disable it, set:

"${_build_nvidia_open=no}"

The module is built for the corresponding kernel version.

Disclaimer

This kernel is provided as-is, without any warranty or guarantee of stability, compatibility, or performance.

It is developed and tested primarily on my own hardware. Experimental patches, release candidates, and other optimizations may introduce regressions or unexpected behavior.

Use it at your own risk.

Credits

Thanks to the Linux kernel developers, CachyOS, ZEN, Clear Linux, XanMod, pf-kernel, and the independent developers whose work makes this project possible.

All credit for individual patches and features belongs to their respective authors and maintainers.

About

hC for Arch Linux

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages