All of lore.kernel.org
 help / color / mirror / Atom feed
* Split process across multiple schedulers?
@ 2022-03-14 15:19 Olsson John
       [not found] ` <b5039be462e8492085b6638df2a761ca-zlDGZTLOEuz3oGB3hsPCZA@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Olsson John @ 2022-03-14 15:19 UTC (permalink / raw)
  To: cgroups-u79uwXL29TY76Z2rM5mHXA

Hi!

I have tried reading the documentation for CGroups V1 and V2 and it seems that there is one usecase that we are interested in that *is* supported by CGroups V1 but not by CGroups V2. I really hope that I have overlooked something and you can tell med to RTFM. ;)

Assume that you want to have a virtual machine running on at least one core. Connected to the VM you need to also have a VMM (Virtual Machine Monitor) that acts as some sort of glue between KVM and the Guest in the VM. For instance Virtual Box on Linux uses QEmu as its VMM. Within the VM each virtual core is connected to a thread in the Host computer, and usually you want to have a 1:1 mapping between virtual core threads and physical cores.

Preferably for optimal performance you want to isolate the cores where the virtual core threads are running so nothing else interferes with them (besides kernel threads connected to IRQs that can't be moved from the isolated cores). The VMM is then running on another core that is not running a virtual core thread. CGroups is the preferred way of accomplishing this. :)

The virtual core threads need to have some parent process and the VMM process is the natural home of for these threads. My understanding of CGroups V1 is that it is possible to have one scheduler associated  there are use cases where you might want to have one kind of scheduler for the VMM process (for instance CFS) and another scheduler for the virtual core threads (for instance FIFO).

My conclusion after reading the documentation for CGroups V2 is that the above scenario is no longer possible to do. Or have I misunderstood something here?


A bit more detailed background after the general idea behind my question. Assume that the software running within the VM is an old Windows 98 game you have the license key for (for instance SimCity 3000). The developers of SimCity 3000 didn't anticipate that you would want to run the game on a computer that was several times faster than what existed at its release. Music plays fine, but when you try to scroll around when zoomed in using the cursor keys on the keyboard (or the mouse by placing the mouse pointer on the edge of the screen) the scrolling speed is inhumanly fast. Basically the game is no longer enjoyable to play. It runs too fast.

Trying to slow it down using a tool like cpulimit is way too coarse; the music is no longer possible to listen to as it is played in bursts. However if you instead have a specially designed scheduler that tries to execute a program with a configured "slow-down"-factor (each scheduling tick you ensure that it is executed only a fraction of that tick) then you could get it to run with a just about right speed. However you do not want to slow down VMM with the same scheduler and thus you want to be able to set different schedulers for different threads within a single process (assuming that they are running on different cores).

And yes, there are other applications for this besides running old games. ;)
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-03-17  9:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 15:19 Split process across multiple schedulers? Olsson John
     [not found] ` <b5039be462e8492085b6638df2a761ca-zlDGZTLOEuz3oGB3hsPCZA@public.gmane.org>
2022-03-14 16:43   ` Michal Koutný
     [not found]     ` <20220314164332.GA20424-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-03-15  8:19       ` [EXTERNAL] " Olsson John
     [not found]         ` <bf2ea0888a9e45d3aafe412f0094cf86-zlDGZTLOEuz3oGB3hsPCZA@public.gmane.org>
2022-03-15 10:35           ` Michal Koutný
     [not found]             ` <20220315103553.GA3780-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-03-15 15:49               ` Olsson John
     [not found]                 ` <84e5b8652edd47d29597d499f29753d6-zlDGZTLOEuz3oGB3hsPCZA@public.gmane.org>
2022-03-15 17:33                   ` Michal Koutný
     [not found]                     ` <20220315173329.GB3780-9OudH3eul5jcvrawFnH+a6VXKuFTiq87@public.gmane.org>
2022-03-16  8:17                       ` Olsson John
2022-03-16 16:38   ` Tejun Heo
     [not found]     ` <YjIShE3mwRyNbO53-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-03-16 16:49       ` [EXTERNAL] " Olsson John
     [not found]         ` <e9cac4aba6384c5c91125a9f7d61a4e8-zlDGZTLOEuz3oGB3hsPCZA@public.gmane.org>
2022-03-16 17:32           ` Tejun Heo
     [not found]             ` <YjIfMLG5W2a/E4vX-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-03-17  9:30               ` Olsson John

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.