Synchronized GPU priority scheduling
As Ursulin describe the situation, the "current processing landscape
seems to be more and more composed of pipelines where computations are done
on multiple hardware devices
". The kernel directly controls the
availability of CPU time for the work that is actually done on the CPU.
But, increasingly, computing work is offloaded to GPUs, AI accelerators, or
cryptocurrency-mining peripherals. Those processors, while capable, can also be
overloaded by the demands placed on them. If they run their workloads in a
way that disagrees with the kernel's idea of process priorities, the end
result may not be what the user would like to see.
As an example, Ursulin pointed out that the Chrome browser will lower the priority of tabs that are not currently in the foreground. If one of those background tabs is doing a lot of rendering in the GPU, though, it may slow down the foreground tab even though the background work is supposed to be running at low priority. It turns out that at least some of these GPUs, including some Intel i915 versions, can perform priority-based scheduling internally. But that requires informing the GPU of the relevant priorities, and there is currently no way to communicate those decisions, which are made in user space, to the GPU.
Ursulin's approach is to add the concept of "context nice" to the i915 driver. This value, which is tied to the priority of the process submitting work, is used with suitably capable GPUs to influence the scheduling of that work. This approach works, but only until the priority of the process on the CPU is changed; if the browser switches to a new tab and wants to increase its priority, continuing to run the associated work on the GPU side at a lower priority would not lead to greater user satisfaction. To avoid that problem, Ursulin's patch series adds a new notifier to the scheduler so that interested kernel subsystems can be informed whenever a process's priority is changed. The i915 driver then hooks into that notifier so that it can update its priority information to keep up with the CPU priority of any process that is running work on the GPU.
The notifier has turned out to be the most controversial part of this patch set. Ursulin noted that there could be security concerns with calling into a device driver from deep within the scheduler whenever a process's priority has changed. John Wanghui suggested that a separate "I/O nice" value could be added to control priorities on the GPU; this would be different from the "ionice" that already exists for block I/O but would function in a similar way. Barry Song, instead, complained that the use of simple nice values is insufficient; it does not take into account the effect of control groups or accumulated run time on actual access to the CPU. That could lead to scheduling results on the GPU that would be inconsistent with what happens on the CPU.
Ursulin mostly agreed with Song's criticisms, but also made the claim that even just using the process nice value is better than no control over execution priority on the GPU at all. This initial implementation could be extended later to include support for control groups and such if that seemed warranted. Meanwhile, though, he has concluded that perhaps the scheduler notifier is not necessary after all. By using the current process priority whenever work is submitted to the GPU, similar results would be obtained; the main difference is that a priority change would not apply to work that had already been passed to the GPU. The next version of this patch set, it appears, will drop the notifier.
Ursulin has done some simple benchmark tests where a
graphical application is running alongside a "GPU hog" process. If the GPU
hog is given a low priority, the graphical application is able to produce
significantly higher frame rates than it can in the absence of priority
control. He concluded: "So it appears the
feature can indeed improve the user experience
". It thus seems
likely that some version of this work will eventually find its way into the
mainline; what remains to be seen is how much it will have to change before
it gets there.
Index entries for this article | |
---|---|
Kernel | Device drivers/Accelerators |
Kernel | Scheduler |
Posted Oct 24, 2021 16:07 UTC (Sun)
by jezuch (subscriber, #52988)
[Link] (49 responses)
Posted Oct 24, 2021 16:09 UTC (Sun)
by NYKevin (subscriber, #129325)
[Link] (42 responses)
Posted Oct 24, 2021 22:04 UTC (Sun)
by k8to (guest, #15413)
[Link] (30 responses)
Given being forced into using slack as it is by external factors though, yes I would prefer it to be able to run in the background, although in practice I give it a sandboxed browser session all to itself.
Posted Oct 24, 2021 23:43 UTC (Sun)
by developer122 (guest, #152928)
[Link] (12 responses)
Posted Oct 25, 2021 1:06 UTC (Mon)
by NYKevin (subscriber, #129325)
[Link] (10 responses)
Posted Oct 25, 2021 10:12 UTC (Mon)
by nix (subscriber, #2304)
[Link] (9 responses)
Posted Oct 25, 2021 14:50 UTC (Mon)
by NYKevin (subscriber, #129325)
[Link] (6 responses)
Posted Oct 26, 2021 13:59 UTC (Tue)
by LtWorf (subscriber, #124958)
[Link] (5 responses)
In a better world websites (that are in general malicious and hostile software) would be given an API that always returns success.
Posted Oct 26, 2021 16:02 UTC (Tue)
by fenncruz (subscriber, #81417)
[Link] (1 responses)
Then somehow work out how to use that to fingerprint you to send you even more ads.
Posted Oct 26, 2021 18:13 UTC (Tue)
by LtWorf (subscriber, #124958)
[Link]
Posted Oct 29, 2021 9:15 UTC (Fri)
by taladar (subscriber, #68407)
[Link] (1 responses)
Posted Oct 29, 2021 12:40 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Posted Oct 31, 2021 21:48 UTC (Sun)
by NYKevin (subscriber, #129325)
[Link]
This is exactly what happens if you deny audio permission in Chrome (it just mutes the tab, and the site is none the wiser), because audio was not designed with a "permissions" system in the first place (there's no standardized API by which Chrome, or any user agent, *could* indicate that the entire site, as a whole, is muted). Unfortunately, I don't think any browser currently does this for notifications.
Posted Oct 27, 2021 2:29 UTC (Wed)
by foom (subscriber, #14868)
[Link] (1 responses)
Now, I'm sure there's a way sites could detect that notifications are disabled and put up blocking popups saying "Reddit is better with notifications enabled!" which prevent you from using the site until you enable them...
And, hey, maybe they'll do that in the future for desktop users who can't install the app. Can't pass up a chance to piss off more people, right?
Posted Oct 27, 2021 11:21 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link]
Note that you can now long click on any notification to get access to this configuration UI.
Posted Oct 25, 2021 4:34 UTC (Mon)
by rgmoore (✭ supporter ✭, #75)
[Link]
As a practical matter, the browser has become something pretty close to a guest operating system. The host OS still needs to be in overall control, but things like how to deal with individual tabs in the browser are better dealt with at the guest OS level rather than the host OS level.
Posted Oct 25, 2021 0:56 UTC (Mon)
by roc (subscriber, #30627)
[Link] (4 responses)
Posted Oct 25, 2021 5:37 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (3 responses)
Posted Oct 25, 2021 6:58 UTC (Mon)
by weberm (guest, #131630)
[Link] (2 responses)
Posted Oct 25, 2021 15:46 UTC (Mon)
by marcH (subscriber, #57642)
[Link]
Posted Oct 26, 2021 22:15 UTC (Tue)
by roc (subscriber, #30627)
[Link]
Posted Oct 25, 2021 13:51 UTC (Mon)
by dskoll (subscriber, #1630)
[Link] (11 responses)
I'm not most users, but I hate Slack in both the native app and the browser, so I generally interact with it with an IRC gateway. There are a few, but the one I've chosen is matterircd. As a bonus, this also works nicely with my workplace's Mattermost installation.
I configure the notifications I want from my IRC client (typically, just mentions of my nick.)
Posted Oct 25, 2021 14:52 UTC (Mon)
by NYKevin (subscriber, #129325)
[Link] (10 responses)
Posted Oct 25, 2021 15:16 UTC (Mon)
by dskoll (subscriber, #1630)
[Link]
Yes, exactly! And I am that One! :)
Posted Oct 26, 2021 14:01 UTC (Tue)
by LtWorf (subscriber, #124958)
[Link] (8 responses)
Posted Oct 26, 2021 14:37 UTC (Tue)
by zdzichu (subscriber, #17118)
[Link] (7 responses)
Posted Oct 26, 2021 18:11 UTC (Tue)
by LtWorf (subscriber, #124958)
[Link] (6 responses)
Posted Oct 26, 2021 19:33 UTC (Tue)
by NYKevin (subscriber, #129325)
[Link] (5 responses)
Posted Oct 26, 2021 19:58 UTC (Tue)
by LtWorf (subscriber, #124958)
[Link] (4 responses)
Plus, organizing a union gets real hard in this way.
In some countries, like Italy, there are precise rules on what the boss can check. For example if I login to my personal email address at work, using a work device, it's in any case forbidden to the boss to intercept and read that.
Work emails can be read provided that the employees have been previously informed that this is the case. Otherwise it is not legal to do so.
So you see, with slack… they just made available all the history to the boss, who couldn't previously access it, so people weren't aware of the possibility in advance, so for the boss to read is illegal in Italy. However since they can do so without anyone being notified, this will likely go unpunished.
Now you get why the controversy?
Posted Oct 27, 2021 18:32 UTC (Wed)
by NYKevin (subscriber, #129325)
[Link] (3 responses)
If you're doing work on personal time, that's a totally different problem (of the form "you're not getting paid").
> Plus, organizing a union gets real hard in this way.
In every reasonable jurisdiction I've ever heard of, it's illegal for them to prevent you from organizing a union, although enforcement of this is questionable in the US due to at-will employment (but it is nevertheless the law). You're probably better off just exchanging contact info and then using something like Signal for further communication.
> In some countries, like Italy, there are precise rules on what the boss can check. For example if I login to my personal email address at work, using a work device, it's in any case forbidden to the boss to intercept and read that.
To my understanding, this has simply never been the case in the US.
> Work emails can be read provided that the employees have been previously informed that this is the case. Otherwise it is not legal to do so.
In the US, work emails are the property of the company. I don't know what Italian law says about that, but it seems very strange to me that the company is not allowed to read its own emails.
> So you see, with slack… they just made available all the history to the boss, who couldn't previously access it, so people weren't aware of the possibility in advance, so for the boss to read is illegal in Italy. However since they can do so without anyone being notified, this will likely go unpunished.
If it's enabling them to break Italian law, then I can see how that would be problematic in Italy. Slack needs to comply with local law in every jurisdiction where it operates, and so they should be aware of whatever laws Italy has. If Italian law is as you describe, then obviously Slack should not be enabling employers to violate it.
However, upthread this was described as a problem *in general*, not a problem in Italy. So I'm still not sure why this is such a big deal outside of Italy.
Posted Oct 27, 2021 22:13 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link]
That's the case in the US. There's a Supreme Court ruling that minor use of work-related stuff for personal communication is acceptable and protected. In that case it was about the work phone used for personal calls.
Posted Oct 28, 2021 21:38 UTC (Thu)
by sionescu (subscriber, #59410)
[Link] (1 responses)
Italian jurisprudence in this regards revolves around the concept of the human dignity of the worker, and the right to privacy. I'm not even sure that the concept of ownership of emails is contemplated as such, the way it is in the US.
In practice it seems [1] that currently it might be allowed for an employer to open a mailbox only to ascertain a crime of which the employer already has a reasonable suspicion, but never preventively or for monitoring; more or less the same bar as for a police officer to do an inspection of an automobile.
[1] https://www.laleggepertutti.it/205247_lemail-aziendale-pu...
Posted Nov 7, 2021 7:54 UTC (Sun)
by fgrosshans (guest, #35486)
[Link]
Posted Oct 24, 2021 23:44 UTC (Sun)
by developer122 (guest, #152928)
[Link] (4 responses)
Posted Oct 25, 2021 7:30 UTC (Mon)
by geert (subscriber, #98403)
[Link] (2 responses)
Which Youtube may want to disallow, just like with the Android app?
Posted Oct 25, 2021 7:52 UTC (Mon)
by zdzichu (subscriber, #17118)
[Link] (1 responses)
Posted Oct 25, 2021 8:27 UTC (Mon)
by geert (subscriber, #98403)
[Link]
Posted Oct 25, 2021 11:02 UTC (Mon)
by jezuch (subscriber, #52988)
[Link]
Posted Oct 25, 2021 11:00 UTC (Mon)
by jezuch (subscriber, #52988)
[Link] (1 responses)
Posted Oct 25, 2021 12:15 UTC (Mon)
by rbtree (guest, #129790)
[Link]
https://developer.mozilla.org/en-US/docs/Web/API/Service_...
Posted Oct 25, 2021 18:09 UTC (Mon)
by bartoc (guest, #124262)
[Link] (1 responses)
Posted Oct 25, 2021 20:02 UTC (Mon)
by mjg59 (subscriber, #23239)
[Link]
Posted Oct 25, 2021 20:04 UTC (Mon)
by Wol (subscriber, #4433)
[Link] (1 responses)
Are you sure !?!?!?
Pretty much ANY messaging app, I disable push notifications. I doubt I'm alone. If you're trying to work, push notifications pretty much guarantee you will have a screwed up workflow...
(We've just transitioned from Hangouts to Slack at work. At least hangouts didn't announce new messages when its tab was hidden. And pretty much the first thing I did with Slack was to make sure that it couldn't, either.)
Cheers,
Posted Oct 26, 2021 19:34 UTC (Tue)
by NYKevin (subscriber, #129325)
[Link]
Posted Oct 24, 2021 16:30 UTC (Sun)
by ttuttle (subscriber, #51118)
[Link]
Posted Oct 24, 2021 18:31 UTC (Sun)
by ericonr (guest, #151527)
[Link] (1 responses)
Posted Oct 24, 2021 22:06 UTC (Sun)
by k8to (guest, #15413)
[Link]
Posted Oct 24, 2021 20:26 UTC (Sun)
by roc (subscriber, #30627)
[Link] (2 responses)
Literal SIGSTOP isn't the way to do it because a process could be running multiple pages from the same site, some of which are foreground and others of which are in the background. (Splitting those out into their own processes would produce unnecessary memory bloat.)
Fixing "throttling leaks" like this GPU issue makes sense, but I'm not sure there's room to be significantly more aggressive with throttling without breaking the user experience in many cases.
Posted Oct 25, 2021 11:07 UTC (Mon)
by jezuch (subscriber, #52988)
[Link] (1 responses)
Posted Oct 26, 2021 22:17 UTC (Tue)
by roc (subscriber, #30627)
[Link]
Posted Oct 24, 2021 23:39 UTC (Sun)
by developer122 (guest, #152928)
[Link] (6 responses)
Posted Oct 25, 2021 1:07 UTC (Mon)
by roc (subscriber, #30627)
[Link] (5 responses)
Posted Oct 25, 2021 5:38 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (4 responses)
Posted Oct 25, 2021 15:03 UTC (Mon)
by khim (subscriber, #9252)
[Link] (3 responses)
If you don't trust the random web sites then you can just go and play with firmware yourself. But the question “what else but x86 would intel use for power and scheduling management” does, apparently, have an answer: initially Intel used ARC.
Posted Oct 25, 2021 15:39 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (2 responses)
I looked at your references and found none mentioned any relationship between the ME and the GPU.
Posted Oct 25, 2021 16:07 UTC (Mon)
by excors (subscriber, #95769)
[Link]
> The GuC is a small embedded core that supports graphics scheduling, power management and firmware attestation. It is implemented in an i486DX4 CPU (also called P24C and Minute IA), although it seems that since broadwell it has been extended to the Pentium (i586) ISA. It runs a small microkernel call μOS.
(and includes some disassembled GuC firmware as evidence).
There are also microcontrollers for H.265 and for display (see e.g. https://01.org/linuxgraphics/downloads/firmware), and I'd guess those are probably the same architecture as the GuC (to avoid redundant development effort).
NVIDIA has previously said (https://riscv.org/wp-content/uploads/2017/05/Tue1345pm-NV...) they have ~10 microcontrollers per GPU, based on a custom architecture. When Intel has similar requirements, it seems quite sensible for them to use an architecture for which they already have expertise and good development tools and no licensing costs.
Posted Oct 26, 2021 22:22 UTC (Tue)
by roc (subscriber, #30627)
[Link]
The ME and the GUC are different. I think the ME core is on a different physical chip?
Posted Oct 25, 2021 4:03 UTC (Mon)
by alison (subscriber, #63752)
[Link] (1 responses)
Posted Nov 3, 2021 13:47 UTC (Wed)
by BenHutchings (subscriber, #37955)
[Link]
Running git grep -l DRM_SCHED_PRIORITY drivers/gpu shows several of them.
Posted Oct 25, 2021 5:57 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (1 responses)
So "nice" has been completely independent from ionice the whole time? Interesting, that would explain why I always felt that "nice" is useless and gave up trying to use it a long time ago.
> it does not take into account the effect of control groups
Makes me wonder: is defeating process priorities as easy as defeating TCP fairness? Split the work across more processes (resp. connections) and done.
I think many devices (workstations, laptops, smartphones) became single user before any serious thought ever went into a proper definition of what is a "fairness unit". I mean who cares whether tabs prioritization works only 90% of the time, just close some tabs when it fails and done. Same for that long and disk intensive job, just Ctrl-Z it when you need. I don't remember seeing anyone trying to use "nice" interactively, I suspect many people don't even know it exists.
On the other hand, I wonder how it works in the cloud. A long time ago, I experienced spurs of unusable latency with some (too) cheap cloud VM and as expected with any latency issue support was useless. Much more recently I experienced seconds long, complete shell freezes a couple times per hour on a VMware system. I was very proud to have found a super simple way to observe it: an ioping for loop! But again, latency => support did not care.
Posted Oct 25, 2021 18:20 UTC (Mon)
by bartoc (guest, #124262)
[Link]
Nowadays, at least on my (fedora 35, with gnome) system when I launch an application gnome (I think gnome is doing this) will create a systemd .scope unit via systemd's dbus API, and that means the app gets it's own cgroup. I just ran systemd-cgls and observed that all my firefox tab processes are in their own cgroup, helping to prevent resource starvation.
Posted Oct 25, 2021 18:14 UTC (Mon)
by bartoc (guest, #124262)
[Link]
I would think that with all the interest in "cloud gaming" plenty of people are interested in fixing up GPU scheduling (although that use-case requires a lot more work, you need good virtualization support too), as right now I think resource utilization in such services is probably extremely bad.
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Wol
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling
Synchronized GPU priority scheduling