diff options
author | Christian König <christian.koenig@amd.com> | 2021-03-24 15:50:56 +0300 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2021-03-29 12:05:36 +0300 |
commit | 680dcede2762668e7fd9a8d4280453b7f260b680 (patch) | |
tree | 2aa08d4a0d913578d43f6dbb0e949f5a28765440 /drivers/gpu/drm/ttm/ttm_device.c | |
parent | e55f2ffc4dc1052bd1ad4c0d3a51e6f1459c0659 (diff) | |
download | linux-680dcede2762668e7fd9a8d4280453b7f260b680.tar.xz |
drm/ttm: switch back to static allocation limits for now
The shrinker based approach still has some flaws. Especially that we need
temporary pages to free up the pages allocated to the driver is problematic
in a shrinker.
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210324134845.2338-1-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_device.c')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_device.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c index 8e821cddf81c..9b787b3caeb5 100644 --- a/drivers/gpu/drm/ttm/ttm_device.c +++ b/drivers/gpu/drm/ttm/ttm_device.c @@ -53,7 +53,6 @@ static void ttm_global_release(void) goto out; ttm_pool_mgr_fini(); - ttm_tt_mgr_fini(); __free_page(glob->dummy_read_page); memset(glob, 0, sizeof(*glob)); @@ -64,7 +63,7 @@ out: static int ttm_global_init(void) { struct ttm_global *glob = &ttm_glob; - unsigned long num_pages; + unsigned long num_pages, num_dma32; struct sysinfo si; int ret = 0; @@ -78,8 +77,15 @@ static int ttm_global_init(void) * system memory. */ num_pages = ((u64)si.totalram * si.mem_unit) >> PAGE_SHIFT; - ttm_pool_mgr_init(num_pages * 50 / 100); - ttm_tt_mgr_init(); + num_pages /= 2; + + /* But for DMA32 we limit ourself to only use 2GiB maximum. */ + num_dma32 = (u64)(si.totalram - si.totalhigh) * si.mem_unit + >> PAGE_SHIFT; + num_dma32 = min(num_dma32, 2UL << (30 - PAGE_SHIFT)); + + ttm_pool_mgr_init(num_pages); + ttm_tt_mgr_init(num_pages, num_dma32); glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32); |