# Ryzen Micro Stutter Fix



## jardows (Jul 26, 2021)

Since upgrading my desktop computer (Ryzen 3600 CPU) to FreeBSD 13, I have been experiencing some issues with micro stutters.  This was most noticeable in games, but also some when using Firefox.  I first thought this had something to do with the video drivers (which somehow ended being a mess - I have an AMD GPU, but somehow got the Nvidia driver installed which was preventing xf86-video-amdgpu from running) but after clearing up all those issues, still had the problem.  After dedicating some time this weekend to the issue, I eventually came across this post on the FreeBSD mailing lists:



			freebsd 13 ryzen micro stutter
		


The solution was to set `sysctl kern.sched.steal_thresh=1`
Apparently the default is "2"

This seems to be an issue that affects Ryzen CPU's, but I would be interested if it applicable to any similarly high thread-count CPU.  My older Xeon E3-1230 v2 system did not encounter these issues.  

After making this change, I was able to test a couple of the programs where I had been experiencing the issue.  In those programs, the issue had made the experience rather unpleasant, and therefore unusable.  After making this change, these programs ran as smoothly as I expected.  As it was getting rather late last night, I wasn't able to test out everything that was having issues, but so far I am pleased with the improvement.

Putting this out there on the forums in case anyone else is experiencing the issue and is looking here for a fix.


----------



## jmos (Jul 26, 2021)

I haven't noticed a difference regarding the upgrade from 12 to 13. Also I haven't noticed a computer or OS completely without micro stutters. But recently I noticed a heavier one on a Adobe XD site with Firefox (90), which runs like a charm after adjusting this parameter. Also I had those micro stutters on playing YouTube videos if compiled without PulseAudio - now it runs flawless 

So far my first impressions and tests. My hardware: MSI "B450M Mortar Max" (*sigh*), AMD "Ryzen 7 3700x", NVIDIA "GeForce GT 1030 Silent LP 2G"


----------



## rustbucket (Aug 8, 2021)

I think this issue has been going on since at least 12. I recall experiencing this issue over a year ago and giving up trying to run FreeBSD on my main computer at that point. I was and am still using a Ryzen 5 2600X.


----------



## George (Aug 8, 2021)

jardows said:


> The solution was to set `sysctl kern.sched.steal_thresh=1`
> Apparently the default is "2"



PR 256594 suggests setting this to zero.


----------



## Deleted member 67862 (Oct 20, 2021)

This worked, I also use a Ryzen 5 3600X. Thanks a bundle!


----------



## mbernat37 (Oct 23, 2021)

I have the same problem, I set sysctl kern.sched.steal_thresh = 0
 on my ryzen 5 1600x and I still have micro cuts or am I doing something wrong


----------



## Deleted member 67862 (Oct 24, 2021)

mbernat37 said:


> I have the same problem, I set sysctl kern.sched.steal_thresh = 0
> on my ryzen 5 1600x and I still have micro cuts or am I doing something wrong


Try `sysctl kern.sched.steal_thresh=1`

And add the following to a new line in /etc/sysctl.conf:

`kern.sched.steal_thresh=1`


----------



## JT42 (Mar 11, 2022)

OMG!  Old thread, but I just wanted to say thank-you to everyone who contributed.  I've been experiencing this problem ever since I built my first FreeBSD desktop system about six months ago using an MSI X470 and Ryzen 5 3400G.  I switched from the built-in AMD graphics to an old Nvidia GTX 780 and that seemed to help, but I still had a jittery experience which was very annoying.  Adjusting `kern.sched.steal_thresh` to 1 solved (or at least worked around) the problem.

Thanks, everyone!


----------

