11# Optimizing Linux
22
33I am writing this guide to save my progress and let others contribute to increasing linux performance even further;
4- after
5- all, many are better than one. You can use all of them or just a few of them. ** Read a topic fully before starting ** .
4+ after all, many are better than one. You can use all of them or just a few of them. ** Read a topic fully before starting
5+ ** .
66
7- I am currently on [ Nobara] ( https://nobaraproject.org/ ) , so some steps may vary from distro to distro.
7+ I am currently on [ Nobara] ( https://nobaraproject.org/ ) and Ubuntu, so some steps may vary from distro to distro. I have
8+ had
9+ a varied hardware setup with Intel, AMD and NVIDIA.
810
911** NOTE: This guide is not for beginners who are new to Linux** but a few of them can be used safely by them.
1012
13+ ** Check out [ pinned issues] ( https://github.com/sn99/Optimizing-linux/issues ) before starting**
14+
15+ * No AI was used in writing this blog; all the optimizations mentioned here are the ones I use.*
16+
1117## Index
1218
1319- [ Compiling your kernel] ( #compiling-your-kernel )
@@ -18,7 +24,9 @@ I am currently on [Nobara](https://nobaraproject.org/), so some steps may vary f
1824- [ Improving boot time] ( #improving-boot-time )
1925- [ Changing swappiness] ( #changing-swappiness )
2026- [ Changing scaling_governor to performance] ( #changing-scaling_governor-to-performance )
21- - [ Improving graphic card performance] ( #improving-graphic-card-performance )
27+ - [ Improving graphic card performance] ( #improving-graphic-performance )
28+ - [ AMD] ( #amd )
29+ - [ NVIDIA] ( #nvidia )
2230- [ Some other tweaks] ( #some-other-tweaks )
2331
2432---------------------------------------------------
@@ -68,7 +76,8 @@ You might want to google `How to make custom kernel in <distro>` to get the pack
6876 dmesg --level=warn
6977 ```
7078 To see if you can enable some extra flags for extra features. For
71- example, `psmouse serio1: elantech: The touchpad can support a better bus than the old PS/2 protocol. Make sure MOUSE_PS2_ELANTECH_SMBUS and MOUSE_ELAN_I2C_SMBUS are enabled to get a better touchpad experience.`
79+ example,
80+ `psmouse serio1: elantech: The touchpad can support a better bus than the old PS/2 protocol. Make sure MOUSE_PS2_ELANTECH_SMBUS and MOUSE_ELAN_I2C_SMBUS are enabled to get a better touchpad experience.`
7281 can be solved by enabling both of them.
7382
7483
@@ -160,11 +169,13 @@ non-bootable.
160169 UUID=<do-not-change> /boot/efi vfat umask=0077,shortname=winnt 0 2
161170 UUID=<do-not-change> /home btrfs subvol=home,x-systemd.device-timeout=0,ssd,noatime,space_cache,commit=120,compress=zstd,discard=async,lazytime 0 0
162171 ```
163- > Optional : `nobarrier`
164-
165- `nobarrier` option is safe as long you didn' t expect sudden powerloss happens or has battery-backed.
166-
167- _On a device with a volatile battery-backed write-back cache, the nobarrier option will not lead to filesystem corruption as the pending blocks are supposed to make it to the permanent storage._ [man 5 btrfs](https://btrfs.readthedocs.io/en/latest/btrfs-man5.html)
172+ > Optional : `nobarrier`
173+
174+ `nobarrier` option is safe as long you didn' t expect sudden powerloss happens or has battery-backed.
175+
176+ _On a device with a volatile battery-backed write-back cache, the nobarrier option will not lead to filesystem
177+ corruption as the pending blocks are supposed to make it to the permanent
178+ storage._ [man 5 btrfs](https://btrfs.readthedocs.io/en/latest/btrfs-man5.html)
168179
1691802. ` sudo systemctl daemon-reload`
170181
@@ -181,7 +192,9 @@ few other security add-ons. Nonetheless, if you understand the security concerns
181192substantial
182193boost in performance.
183194
184- 1. ` sudo grubby --args " mitigations=off nowatchdog processor.ignore_ppc=1 amdgpu.ppfeaturemask=0xffffffff ec_sys.write_support=1 split_lock_detect=off" --update-kernel=ALL`
195+ 1.
196+
197+ ` sudo grubby --args " mitigations=off nowatchdog processor.ignore_ppc=1 amdgpu.ppfeaturemask=0xffffffff ec_sys.write_support=1 split_lock_detect=off" --update-kernel=ALL`
185198
186199OR
187200
202215
203216 ` sudo grub2-mkconfig -o /etc/grub2.cfg`
204217
218+ OR
219+
220+ ` sudo update-grub`
221+
205222After rebooting, you can run ` cat /proc/cmdline` to see your boot options.
206223
207224# # Improving boot time
@@ -270,7 +287,16 @@ gets [fixed](https://www.phoronix.com/scan.php?page=article&item=linux511-amd-pa
270287
271288**Note**: You can also change the default during the kernel compilation.
272289
273- ## Improving graphic card performance
290+ ## Improving graphic performance
291+
292+ Graphic cards are tricky, the best support is for AMD on the other hand NVIDIA has the ray tracing and frame-gen
293+ cornered,
294+ atleast for now. You can try overclocking your GPU(s) to get better performance, your mileage may vary.
295+
296+ - Install `power-profiles-daemon` and install power profiles indicator applet (Both should be preinstalled in most
297+ distros). → Set it to `Performance` while gaming.
298+
299+ ### AMD
274300
275301You can find overclocking tools specific to your GPU(s), but to make sure your graphics card isn’t being suppressed by
276302the OS (especially AMD):
@@ -299,6 +325,66 @@ the OS (especially AMD):
299325
300326 You can change them back to `auto` if your system overheats.
301327
328+ ### NVIDIA
329+
330+ I tried a lot to get it on par with windows (or even surpass it), but unlike AMD, it is not easy. You can find distro
331+ specific settings
332+ or blogs or writeup that other people have done that delve deeper into it.
333+
334+ What has worked for me:
335+
336+ **1.** Open NVIDIA X Settings → PRIME profiles → set to Performance Mode
337+
338+ **2.** On laptops atleast NVIDIA seems to limit the wattage available by more than half, you can check it by running
339+ `nvidia-smi -q | grep -i "Power Limit" -A4`:
340+
341+ ```
342+ $ nvidia-smi -q | grep -i "Power Limit" -A4
343+
344+ Current Power Limit : 35.00 W
345+ Requested Power Limit : 35.00 W
346+ Default Power Limit : 35.00 W
347+ Min Power Limit : 5.00 W
348+ Max Power Limit : 95.00 W
349+ GPU Memory Power Readings
350+ Average Power Draw : N/A
351+ Instantaneous Power Draw : N/A
352+ ```
353+
354+ This most probably means `nvidia-powerd.service` either doesn' t exist or is not running. To fix it:
355+
356+ ` ` ` shell
357+ sudo systemctl enable nvidia-powerd.service
358+ sudo systemctl start nvidia-powerd.service
359+ ` ` `
360+
361+ When the above fails try this:
362+
363+ - Copy ` /usr/share/doc/nvidia-driver-xxx/nvidia-dbus.conf` into ` /etc/dbus-1/system.d/` and also
364+ ` /usr/share/doc/nvidia-kernel-common-xxx/nvidia-powerd.service` in ` /etc/systemd/system/` .
365+ - Restart the system and run the above commands again.
366+
367+ ** Note:** In my case I was not able to find ` nvidia-dbus.conf` , but ` nvidia-powerd.service` existed.
368+
369+ You can find these and more NVIDIA related documentation on https://download.nvidia.com/XFree86/Linux-x86_64/. Select
370+ your
371+ driver based on ` nvidia-smi` output -> Open ` README` . The above configs instructions are under " Dynamic Boost on Linux" .
372+
373+ If you have done everything correctly till now you should be able to see new wattages:
374+
375+ ` ` `
376+ $ nvidia-smi -q | grep -i " Power Limit" -A4
377+
378+ Current Power Limit : 80.00 W
379+ Requested Power Limit : 80.00 W
380+ Default Power Limit : 35.00 W
381+ Min Power Limit : 5.00 W
382+ Max Power Limit : 95.00 W
383+ GPU Memory Power Readings
384+ Average Power Draw : N/A
385+ Instantaneous Power Draw : N/A
386+ ` ` `
387+
302388# # Some other tweaks
303389
304390- [ArchWiki/Improving performance](https://wiki.archlinux.org/index.php/Improving_performance)
0 commit comments