drm/amdgpu: Adjust logic around GTT size (v3)
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 19 May 2022 14:21:08 +0000 (10:21 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Jun 2022 21:55:01 +0000 (17:55 -0400)
commitf7ba887f606b1895dabf718547cf7397924f0d3a
tree487a4d6dc3f1f5db05af238f0e7cfbbd0578ac39
parent1f43b8903f3aae4a26a603c36f6d5dd25d6edb51
drm/amdgpu: Adjust logic around GTT size (v3)

Certain GL unit tests for large textures can cause problems
with the OOM killer since there is no way to link this memory
to a process.  This was originally mitigated (but not necessarily
eliminated) by limiting the GTT size.  The problem is this limit
is often too low for many modern games so just make the limit 1/2
of system memory. The OOM accounting needs to be addressed, but
we shouldn't prevent common 3D applications from being usable
just to potentially mitigate that corner case.

Set default GTT size to max(3G, 1/2 of system ram) by default.

v2: drop previous logic and default to 3/4 of ram
v3: default to half of ram to align with ttm
v4: fix spelling in comment (Kent)

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1942
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c