Revive Your Old Gaming PC on Linux: A Step-by-Step Scheduler Optimization Guide

By

Introduction

If you’re gaming on Linux with hardware that’s seen better days, you might have noticed sluggish performance when multiple tasks are running in the background. The culprit? A Linux scheduler that doesn’t play well with cgroup scheduling on older systems or high-core-count machines. Developer Peter Zijlstra has proposed a kernel patch that flattens the scheduler’s task selection process, potentially breathing new life into your old potato PC. While the patch isn’t in the mainline kernel yet, you can already test the fix or use a temporary workaround with a shorter scheduler time slice. This guide will walk you through everything you need to optimize your Linux gaming experience on older hardware.

Revive Your Old Gaming PC on Linux: A Step-by-Step Scheduler Optimization Guide
Source: itsfoss.com

What You Need

Step-by-Step Guide

Step 1: Assess Your Current Performance Baseline

Before applying any changes, run your game under normal conditions to have a baseline. Launch your game via Lutris or Steam, and record metrics with MangoHud. For our example, we’ll use Shadows: Awakening on Proton (GE-Proton10-34 and Steam Runtime 3 (sniper)). Simulate background load by starting 8 spinning processes (one per CPU thread) using stress -c 8. Note the minimum, average, and maximum FPS and frame times.

Step 2: (Optional) Apply the Linux Kernel Patch

This step is for advanced users who want to try Zijlstra’s patch series “sched: Flatten the pick.” The patch aims to fix weight fragmentation in cgroup scheduling.

  1. Get the patch: Find the latest version (v2 as of writing) from the Linux kernel mailing list or Phoronix.
  2. Download kernel source: Use git clone from kernel.org or your distribution’s source.
  3. Apply the patch: Navigate to the kernel source directory and run patch -p1 < /path/to/patch.
  4. Compile and install: Configure your kernel (keep existing config), compile (make -j$(nproc)), and install (sudo make modules_install install). Reboot into the new kernel.
  5. Test: Repeat the baseline test with the patched kernel. Note that Zijlstra did not compare with and without the patch in his experiment; he focused on the slice workaround.

Important: This patch is still under review and may change. Proceed with caution.

Step 3: Use the Temporary Workaround – Shorten the Scheduler Time Slice

If you don’t want to patch the kernel, you can get a similar benefit by reducing the scheduler time slice to one-tenth of the default value. Zijlstra used chrt to set this for his gaming session.

  1. Find your game’s process ID (PID): Launch the game, then run ps aux | grep [game-name] to get the PID.
  2. Set a shorter time slice: Use the chrt command with the --deadline or --slice option. For example, to set the slice to 0.1ms (one-tenth of default 1ms): sudo chrt --slice 100000:0:0 -p PID (adjust slice duration as needed; default is 1,000,000 ns). Alternatively, you can run the entire game with a one-tenth slice from the start: sudo chrt --slice 100000:0:0 [game-launcher].
  3. Verify: Check the scheduler parameters with chrt -p PID.
  4. Monitor performance: Use MangoHud while playing with the shorter slice.

Step 4: Repeat Tests with Background Load

To replicate Zijlstra’s stress test, run 8 spinner processes (one per CPU thread) alongside the game. You can use stress -c 8 or a custom script that spins indefinitely. Record metrics with MangoHud for both the default slice and the shorter slice. Compare results.

Revive Your Old Gaming PC on Linux: A Step-by-Step Scheduler Optimization Guide
Source: itsfoss.com

Step 5: Analyze and Compare Results

Based on Zijlstra’s experiment with an older i7-2600K and RX 580 in Shadows: Awakening, here’s what you can expect:

MetricDefault sliceShorter slice (one-tenth)
FPS min3.820.6
FPS avg48.057.2
FPS max87.480.3
Frame time min (ms)9.48.4
Frame time avg (ms)34.519.5
Frame time max (ms)107.437.2

Notice the significant improvement in minimum FPS and frame time consistency. Your mileage may vary.

Tips and Considerations

With these steps, you can optimize your old gaming PC on Linux today. Whether you wait for the official patch or use the chrt workaround, you’ll likely see smoother gameplay under load.

Related Articles

Recommended

Discover More

US-Sanctioned Crypto Exchange Grinex Ceases Operations After $15M Hack Blamed on 'Unfriendly States'7 Key Insights into Amp's Neo CLI and the Future of AI Coding AgentsEstablishing Credibility in a New Role: A Guide to Building Workplace TrustDemystifying Android AICore: 5 Crucial Facts About Its Storage SpikesBartender Pro Turns Your Mac's Notch into a Dynamic Command Center