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>
Wed, 22 Jun 2022 21:11:16 +0000 (17:11 -0400)
commitf15345a377c6ea9c7cc74f079616af8856aff37f
treeaeff505298a1ef5de5c1d13f727da15b8bbdd53d
parenta111daf0c53ae91e71fd2bfe7497862d14132e3e
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