This reverts commit dd8dde5745eaf7509d5565d539d0c0bf4148bfe7. With __GFP_RETRY_MAYFAIL instead of __GFP_NORETRY, an allocation at the beneficial order no longer fails fast when compaction cannot form a block. It enters direct reclaim and the reclaim/compaction retry loops, for every chunk of every new BO. amdgpu sets the beneficial order to 2 MiB, and on APUs most BOs are system memory. On a Radeon 610M with fragmented memory, the compositor enters direct reclaim at order 9 from amdgpu_gem_create_ioctl(), and the cursor and window switching stall. Seen on distribution kernels, with kwin_wayland and plasmashell on 7.3-rc4 and with gnome-shell on 7.3.5: 87 direct reclaims in 15 s, all order 9 with gfp_flags 0x386dc2, the gnome-shell cgroup spending up to 514 ms of each second stalled on memory with its main thread running in reclaim and compaction rather than blocked. With one page pinned per pageblock on 7.3-rc6, 64 order-9 allocations with the TTM flags took 12 ms at the median and up to 321 ms with this commit, against 0.1 ms without it. Each run reclaimed about 280 MiB directly, pushed about 0.4 GiB to swap, and the retries got one 2 MiB page in 128 attempts. Fixes: dd8dde5745ea ("drm/ttm/pool: Try harder for beneficial orders") Cc: stable@vger.kernel.org # v7.3+ Cc: Matthew Brost Cc: Christian Koenig Cc: Huang Rui Cc: Matthew Auld Cc: Thomas Hellström Cc: Alex Deucher Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Rogerio Lucas --- drivers/gpu/drm/ttm/ttm_pool.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 1bf37023..48a7d5b6 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -183,11 +183,6 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, if (order && beneficial_order && order != beneficial_order) gfp_flags &= ~__GFP_RECLAIM; - if (beneficial_order && order == beneficial_order) { - gfp_flags &= ~__GFP_NORETRY; - gfp_flags |= __GFP_RETRY_MAYFAIL; - } - if (!ttm_pool_uses_dma_alloc(pool)) { p = alloc_pages_node(pool->nid, gfp_flags, order); if (p) { -- 2.56.1