Linus Torvalds dispelled issues with the task scheduler that arose in the performance test.

Game Developer Malte Skarupke announced comparison of performance of locks based on Mutex and Spinlock the use of different task schedulers. The tests showed abnormally high latencies when using Spinlock with the default scheduler used in Linux. The test author concluded that the Linux task scheduler has issues that negatively impact the performance of games developed for the Google Stadia service, where games run on a GPU in a cloud environment, and the client streams the screen content at up to 60 frames per second. Under these conditions, timely frame output to the screen is essential, and delays exceeding a millisecond become noticeable.

Regarding the tests connected Linus Torvalds, who referred to them as garbage (‘pure garbage’) and an example of how one can obtain results that do not reflect reality without fully understanding the topic. Spinlock is a low-level primitive that should be used in user space with great caution and a full understanding of the details, otherwise, one may obtain what the test author demonstrated. Linus advised game developers not to use spinlock and not to attempt to create their own locking systems based on it, but to use existing proven mechanisms that inform the system about waiting for the lock to be released to avoid scheduler interference.

Spinlock-based wrappers can only be used when there is complete confidence that the scheduler will not interrupt their execution. The locks tested, based on spinlock, are implemented through a homemade wrapper that operates in user space. The task scheduler can take control at any random moment during the execution of this wrapper and switch to executing another task. Since performance measurement is based on absolute timer values, certain delays in the tests encompass not only the delays in the lock handler but also the code executed in another context, i.e., they measure not only what the test author attempted to measure, but also 'noise' from other computations in the system.

Test Author attempted Disagree with Linus by pointing out that the use of custom blocking systems based on spinlocks is often employed in practice in games, as tests show higher performance when using simpler schedulers than Linux. argued, that the Linux scheduler is universal, honed for decades and optimized not only for desktops and games but also for other types of loads, such as server systems, and therefore takes into account numerous nuances when scheduling task execution.

Adding specific optimizations that reduce latency in Google Stadia games may improve responsiveness in certain cases, but will likely lead to decreased overall scheduler efficiency. For example, the Windows scheduler performs better in the discussed tests, as it is significantly simpler than the Linux scheduler and is primarily optimized for desktop-specific tasks.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster