Score:0

Having stuttering on Ubuntu 20.04 while gaming with Windows dual boot

de flag

I recently decided to dual boot Ubuntu to give it a try as my main platform, as I like the look and feel of it and I'd really like to get away from Windows. But for whatever reason, whatever game I'm playing will freeze/drop fps for a bit before going back to normal. I know it isn't a hardware issue, as on the same exact games run perfecy fine on Windows. I've tested it with Tomb Raider (on proton, not the terrible linux port), Final Fantasy XIV, Rise of the Tomb Raider, and Slime Rancher. Looking at mangohud it seems my gpu usage is all over the place. Specifically in the Rise of the Tomb Raider benchmark sometimes my GPU usage is at 100% and is producing the expected amount of FPS, but then in another area it drops to about 59%, which in turn causes my FPS to drop from ~144 to 50-70FPS. And while running it my fps occasionally drops as low as in the 30's before going back up to 70, as the benchmark tells me the minimum. I've tried setting my CPU to performance, ondemand, schedutil, none of them seem to make much of a difference. And while using mangohud my CPU goes up to 64% at absolute most, and as I said I have no issue on Windows so it isn't a CPU bottleneck. I'm at a loss as to what the issue is, and if I could get it fixed I could see myself using the platform as my main since all of my games seem to work well enough with proton(minus the stuttering).

My specs are: ASRock AB350M 16GB ram ZOTAC Gaming RTX2060 Super (driver 460.91.03, also tried 470.57.02, didn't work) AMD Ryzen 5 1600x One Asus monitor(60hz), one Dell with GSync(144hz) And here's a pastebin of lshw in case I forgot anything: https://pastebin.com/7qdVFE72

  What I've tried:

Changing CPU governor to performance Disabling Wayland Installing Pop!_OS, reinstalling Ubuntu(multiple times) Downgrading drivers Changed GPU to performance in nvidia x server settings Disabling quiet n' cool in BIOS Forcing full composition pipeline Installed onto a different SSD (I have 3) Saving to X configuration file Disabling/Enabling Sync to VBlank

Again, everything works completely fine on Windows, so I don't believe this is a hardware issue at all. Even looking at temperatures on mangohud, everything checks out. At this point I've been researching for what feels like eternity and nothing has helped, so any help would be appreciated. Edit: Pastebin with the results of free -h, sysctl vm.swappiness, and swapon -s https://pastebin.com/JfBa1pAh

Zanna avatar
kr flag
Hi folks! This conversation has been [moved to chat](https://chat.stackexchange.com/rooms/128244/discussion-on-question-by-imnapr-having-stuttering-on-ubuntu-20-04-while-gaming) which will hopefully be more convenient.
Score:0
ru flag

BIOS

ASRock AB350M

You have a very old BIOS version P3.10 dated 08/30/2017. Go to here and download and install the newer BIOS.

Note: Carefully read the various version warnings on the site.

Note: Have good backups before updating the BIOS.

overclocking

If your CPU or RAM is overclocked, please set it back to default, and retest.

memory

Ryzen 5 1600x (Summit Ridge)

Kingston KHX2666C16/8G

Ryzen processors are very fussy about memory compatibility. Your Kingston memory does not appear on the ASRock memory compatibility list.

Go to https://www.memtest86.com/ and download/run their free memtest to test your memory. Get at least one complete pass of all the 4/4 tests to confirm good memory. This may take many hours to complete.

swap/vm.swappiness

Your /swapfile is too small at 2G, and your vm.swappiness is wrong.

Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 16G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

Edit /etc/sysctl.conf and set vm.swappiness=10 and then do sudo sysctl -p. This will still minimize swapping, which, I believe, was your original intent.

Ubuntu

If all of the above fails to solve the problem, prepare a Ubuntu Live 21.04 DVD/USB and boot to it. Install the latest Nvidia video driver (if possible). Retest.

Update #1:

The BIOS has been updated. It did not help with the problem.

Update #2:

memtest passed. vm.swappiness set to 10. /swapfile resized to 4G, overclocking set to "Auto". Ubuntu Live 21.04 USB has same problem (but of course it has a smaller /swapfile).

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.