mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
MISRA rule 17.2 forbids recursion as a hazard on the stack space. To comply and additionally to make the code somewhat more straightforward to read, rewrite the runlist construction with three explicit functions that work as the three levels of the earlier recursion. These levels map to the three priority levels of TSGs and having more than that is unlikely. When "runlist interleaving" is enabled, TSGs with higher priorities get interleaved between the switch of each pair of lower-level priority TSGs, so that the latency for a job at priority level X is no more than all jobs' timeslices of priority X and higher, plus at most one job at a lower level. This can be illustrated as follows (low, medium, high TSGs 1 and 2): L1 L2 (only low-priority TSGs) H1 H2 (only high-priority TSGs) H1 H2 M1 H1 H2 M2 (no low-priority TSGs) M1 M2 L1 M1 M2 L2 (no high-priority TSGs) H1 H2 L1 H1 H2 L2 (no medium-priority TSGs) H1 H2 M1 H1 H2 M2 H1 H2 L1 H1 H2 M1 H1 H2 M2 H1 H2 L2 (no empty levels) Without interleaving, the items are simply grouped by priority. Jira NVGPU-1174 Change-Id: Ic3b5106945df7105633730ecd1d150af770a5e83 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1918226 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>