[PATCH] drm/lima: allow to retry when allocating memory for BO

Icenowy Zheng icenowy at aosc.io
Thu Sep 26 10:52:40 UTC 2019


Currently, when allocating the memory for BO by Mesa, the lima kernel
driver set only GFP_DMA32 flag; and this allocation may fail when the
memory is relatively adequate, thus retrying is needed.

Add the GFP flags for retrying memory allocation.

Signed-off-by: Icenowy Zheng <icenowy at aosc.io>
---
 drivers/gpu/drm/lima/lima_object.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/lima/lima_object.c b/drivers/gpu/drm/lima/lima_object.c
index 87123b1d083c..1389aa1b948b 100644
--- a/drivers/gpu/drm/lima/lima_object.c
+++ b/drivers/gpu/drm/lima/lima_object.c
@@ -91,7 +91,9 @@ struct lima_bo *lima_bo_create(struct lima_device *dev, u32 size,
 			goto err_out;
 		}
 	} else {
-		mapping_set_gfp_mask(bo->gem.filp->f_mapping, GFP_DMA32);
+		mapping_set_gfp_mask(bo->gem.filp->f_mapping,
+				     GFP_DMA32 | __GFP_RETRY_MAYFAIL |
+				     __GFP_NOWARN);
 		bo->pages = drm_gem_get_pages(&bo->gem);
 		if (IS_ERR(bo->pages)) {
 			ret = ERR_CAST(bo->pages);
-- 
2.21.0



More information about the dri-devel mailing list