Should I change these?

Greetings lovely community,

I recently came across one of those ‘Things To Do After Install’ posts recently (source link here) and it got me wondering if I could benefit from using anything from the list that I haven’t already used and tried myself. I came across two optional settings to adjust.

One is enabling SSD Trim:

sudo systemctl enable fstrim.timer

sudo systemctl start fstrim.timer

And the other changing ‘Swappiness value to 10’ (my default value is 60):

echo vm.swappiness=10 | sudo tee /etc/sysctl.d/99-swappiness.conf

systemctl reboot

cat /proc/sys/vm/swappiness

Now I haven’t run any of these commands yet, but I’m reaching out here to find out and hopefully figure out if these adjustments would be right for my system or if I wouldn’t see any benefit to them, please feel free to let me know. I’ve read up on a bit of each of them to know what they do in a technical sense, but at the moment I’m just still a bit unsure if they are really even necessary for my system. Any advice, comments, or suggestions would be much appreciated, thank you very much.

Below I’ll leave my system info:

[scott@endeavourOS ~]$ inxi -Fxxxza --no-host
System:
  Kernel: 5.15.2-arch1-1 x86_64 bits: 64 compiler: gcc v: 11.1.0
  parameters: BOOT_IMAGE=/boot/vmlinuz-linux
  root=UUID=2c6a8f39-939c-47a4-9d95-dabf69e6f5c6 rw nvidia-drm.modeset=1
  quiet loglevel=3 nowatchdog
  Desktop: GNOME 41.1 tk: GTK 3.24.30 wm: gnome-shell dm: GDM 40.0
  Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Laptop System: Acer product: Aspire E5-576G v: V1.32 serial: <filter>
  Mobo: KBL model: Ironman_SK v: V1.32 serial: <filter> UEFI: Insyde v: 1.32
  date: 10/24/2017
Battery:
  ID-1: BAT1 charge: 15.9 Wh (100.0%) condition: 15.9/62.2 Wh (25.6%)
  volts: 12.6 min: 11.1 model: PANASONIC AS16B5J type: Li-ion
  serial: <filter> status: Full
CPU:
  Info: Quad Core model: Intel Core i5-8250U bits: 64 type: MT MCP
  arch: Kaby Lake note: check family: 6 model-id: 8E (142) stepping: A (10)
  microcode: EA cache: L2: 6 MiB
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  bogomips: 28808
  Speed: 3400 MHz min/max: 400/3400 MHz Core speeds (MHz): 1: 3400 2: 3400
  3: 3400 4: 3400 5: 3218 6: 3400 7: 3164 8: 3400
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf
  mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: spec_store_bypass
  mitigation: Speculative Store Bypass disabled via prctl and seccomp
  Type: spectre_v1
  mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Full generic retpoline, IBPB: conditional,
  IBRS_FW, STIBP: conditional, RSB filling
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel UHD Graphics 620 vendor: Acer Incorporated ALI driver: i915
  v: kernel bus-ID: 00:02.0 chip-ID: 8086:5917 class-ID: 0300
  Device-2: NVIDIA GP108M [GeForce MX150] vendor: Acer Incorporated ALI
  driver: nvidia v: 495.44 bus-ID: 01:00.0 chip-ID: 10de:1d10 class-ID: 0302
  Device-3: Chicony HD WebCam type: USB driver: uvcvideo bus-ID: 1-7:4
  chip-ID: 04f2:b571 class-ID: 0e02
  Display: x11 server: X.Org 1.21.1.1 compositor: gnome-shell driver:
  loaded: modesetting,nvidia display-ID: :1 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x286mm (20.0x11.3")
  s-diag: 583mm (23")
  Monitor-1: eDP-1-1 res: 1920x1080 hz: 60 dpi: 142
  size: 344x194mm (13.5x7.6") diag: 395mm (15.5")
  OpenGL: renderer: NVIDIA GeForce MX150/PCIe/SSE2 v: 4.6.0 NVIDIA 495.44
  direct render: Yes
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Acer Incorporated ALI
  driver: snd_hda_intel v: kernel bus-ID: 00:1f.3 chip-ID: 8086:9d71
  class-ID: 0403
  Sound Server-1: ALSA v: k5.15.2-arch1-1 running: yes
  Sound Server-2: JACK v: 1.9.19 running: no
  Sound Server-3: PulseAudio v: 15.0 running: yes
  Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:
  Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi
  v: kernel bus-ID: 03:00.0 chip-ID: 8086:24fb class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
  vendor: Acer Incorporated ALI driver: r8168 v: 8.049.02-NAPI port: 3000
  bus-ID: 04:00.1 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0f1 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Wireless-AC 3168 Bluetooth type: USB driver: btusb v: 0.8
  bus-ID: 1-5:3 chip-ID: 8087:0aa7 class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 238.47 GiB used: 133.41 GiB (55.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: SK Hynix model: HFS256G39TND-N210A
  size: 238.47 GiB block-size: physical: 4096 B logical: 512 B
  speed: 6.0 Gb/s type: SSD serial: <filter> rev: 1P10 scheme: GPT
Partition:
  ID-1: / raw-size: 237.97 GiB size: 233.17 GiB (97.99%)
  used: 133.41 GiB (57.2%) fs: ext4 dev: /dev/sda2 maj-min: 8:2
  ID-2: /boot/efi raw-size: 512 MiB size: 511 MiB (99.80%)
  used: 296 KiB (0.1%) fs: vfat dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 512 MiB used: 0 KiB (0.0%) priority: -2
  file: /swapfile
Sensors:
  System Temperatures: cpu: 67.0 C mobo: N/A gpu: nvidia temp: 55 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 302 Uptime: 21h 56m wakeups: 1 Memory: 15.51 GiB
  used: 5.71 GiB (36.8%) Init: systemd v: 249 tool: systemctl Compilers:
  gcc: 11.1.0 Packages: pacman: 1297 lib: 297 flatpak: 0 Shell: Bash v: 5.1.8
  running-in: tilix inxi: 3.3.07
[scott@endeavourOS ~]$ 
1 Like

Well, you have a lot of RAM and a tiny swap file, so your system probably uses swap very rarely, if at all, and changing the swappiness would have very little effect. You could reduce it to 10 to make it even less likely that your system will ever use that tiny swap file, but it’s really not necessary. In any case, changing swappiness is not dangerous at all, and the change applies instantly (no need to reboot), so if you feel like it, you could experiment with various values and see whether that will have any noticeable effect when your system is under heavy load. My guess is that it won’t.

Regarding fstrim, you have to figure out whether your SSD supports it (it probably does and, if so, you should enable it). Read more about it here:
https://wiki.archlinux.org/title/Solid_state_drive

Also, make sure you do not have the “discard” option set for this drive in your /etc/fstab

5 Likes

I agree with the advice of @Kresimir. I also have 16GB RAM, and haven’t bothered changing the swappiness for years now.

My SSD supports TRIM, so I have enabled fstrim.

4 Likes

Here’s my own experience with reducing swappiness:

Being a beginner, I have set the swappiness to 10 after installing EOS. Don’t take my word for it, but I remember I have read somewhere that this might reduce the writing actions on the SSD and thus increase its lifetime a bit.

I do not notice any difference in speed or performance, but there are no adverse effects either, so I don’t regret reducing the swappiness :slightly_smiling_face:.

Here is one discussion I found with informative answers concerning swappiness: https://askubuntu.com/questions/184217/why-most-people-recommend-to-reduce-swappiness-to-10-20

1 Like

512MB is a fairly odd and small swapfile.

1 Like

It’s the default when choosing a swapfile in the :enos: installer (at least it is for me each time).

With my 16GB of RAM, it’s rare that any swap is used with swappiness at 60, and it’s also very rare that I use more than half my RAM. If I had as little as 4GB RAM (as in the link from @maqni), then I would have a larger swap file, and adjust swappiness.

1 Like

@Kresimir @mshmm Checked to see if my SSD supports TRIM:

[scott@endeavourOS ~]$ sudo hdparm -I /dev/sda | grep TRIM
	   *	Data Set Management TRIM supported (limit 1 block)
	   *	Deterministic read data after TRIM
[scott@endeavourOS ~]$ 

Looks good ya?

Also here’s my fstab:

  GNU nano 5.9                                                                              /etc/fstab                                                                                         
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=BB5D-4A9F                            /boot/efi      vfat    umask=0077 0 2
UUID=2c6a8f39-939c-47a4-9d95-dabf69e6f5c6 /              ext4    defaults,noatime 0 1
/swapfile                                 swap           swap    defaults,noatime 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

Things look good to give SSD TRIM a go I think?

Edit: Thanks for the answers so far everyone, very much appreciated! :slight_smile:

2 Likes

Yeah this is the default value for me as well, I didn’t change it or anything. On other distributions though, the Swap file is usually larger than this, like usually ~2GB of Swap file. I thought 512MB was low too, but I tap into the Swap file maybe like 4-5 times a weeks, so was kind of wondering if I should change it at all or just leave it. I do some video/audio recording, so I do tend to eat away at my 16GB of RAM from time to time.

Zram is also a good option for having a swap device, just in case it is ever needed.
There are several ways of creating it. Archwiki has good instructions on it.

But this makes me wonder if zram is a good option in this case. Perhaps someone will comment on this.

1 Like

Perhaps follow @Kresimir’s advice on experimentation then.

1 Like

I haven’t tested the Swapiness = 10 option yet, but I went ahead and enabled SSD TRIM, think I did it correctly. Wasn’t sure if I was supposed to run ‘start’ or ‘enable’ command first, but I went with what I saw on the EndeavourOS wiki HERE

[scott@endeavourOS ~]$ sudo systemctl start fstrim.timer
[sudo] password for scott: 
[scott@endeavourOS ~]$ sudo systemctl enable fstrim.timer
Created symlink /etc/systemd/system/timers.target.wants/fstrim.timer → /usr/lib/systemd/system/fstrim.timer.
[scott@endeavourOS ~]$ systemctl status fstrim.timer
● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: disabled)
     Active: active (waiting) since Sun 2021-11-21 12:34:41 EST; 19min ago
    Trigger: Mon 2021-11-22 00:04:09 EST; 11h left
   Triggers: ● fstrim.service
       Docs: man:fstrim

Nov 21 12:34:41 endeavourOS systemd[1]: Started Discard unused blocks once a week.
[scott@endeavourOS ~]$

Edit: I went ahead and tested out the change in swappiness as well:

echo vm.swappiness=10 | sudo tee /etc/sysctl.d/99-swappiness.conf

systemctl reboot

#(sidenote, this command will instantly reboot your system so save all work before!)

After a reboot, to check if the Swappiness is now 10 (default for me was 60 before this change, FYI):

sudo nano /proc/sys/vm/swappiness

Haven’t noticed any issues or differences, so I’ll leave it see to 10 for now and see how things go!

1 Like

Looks good :sunglasses:

1 Like

5 Likes

Ray Charles driving a bus :sunglasses:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.