From 8dd81f859bc201578c3c6f7d975923c764b221db Mon Sep 17 00:00:00 2001 From: Douglas Anderson Date: Wed, 6 Jan 2016 10:04:33 -0800 Subject: [PATCH] CHROMIUM: rk3288-vpu: Set DMA_ATTR_ALLOC_SINGLE_PAGES We do video allocation all the time and we need it to be fast. Plus TLB efficiency isn't terribly important for video. That means we want to set DMA_ATTR_ALLOC_SINGLE_PAGES See also the previous change ("ARM: dma-mapping: Use DMA_ATTR_ALLOC_SINGLE_PAGES hint to optimize alloc") BUG=chromium:570532 TEST=Memory pressure + cat videos is even smoother! Signed-off-by: Douglas Anderson Reviewed-on: https://chromium-review.googlesource.com/322336 Reviewed-by: Dmitry Torokhov Change-Id: I8bda3d9655daaa893c7bead7108b863607d1614f Signed-off-by: Jeffy Chen Signed-off-by: Yakir Yang --- drivers/media/platform/rk3288-vpu/rk3288_vpu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rk3288-vpu/rk3288_vpu.c b/drivers/media/platform/rk3288-vpu/rk3288_vpu.c index 779513e2e267..ac35b0cf9665 100644 --- a/drivers/media/platform/rk3288-vpu/rk3288_vpu.c +++ b/drivers/media/platform/rk3288-vpu/rk3288_vpu.c @@ -589,6 +589,7 @@ static int rk3288_vpu_probe(struct platform_device *pdev) { struct rk3288_vpu_dev *vpu = NULL; DEFINE_DMA_ATTRS(attrs_novm); + DEFINE_DMA_ATTRS(attrs_nohugepage); struct video_device *vfd; int ret = 0; @@ -611,6 +612,12 @@ static int rk3288_vpu_probe(struct platform_device *pdev) goto err_hw_probe; } + /* + * We'll do mostly sequential access, so sacrifice TLB efficiency for + * faster allocation. + */ + dma_set_attr(DMA_ATTR_ALLOC_SINGLE_PAGES, &attrs_novm); + dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs_novm); vpu->alloc_ctx = vb2_dma_contig_init_ctx_attrs(&pdev->dev, &attrs_novm); @@ -619,7 +626,9 @@ static int rk3288_vpu_probe(struct platform_device *pdev) goto err_dma_contig; } - vpu->alloc_ctx_vm = vb2_dma_contig_init_ctx(&pdev->dev); + dma_set_attr(DMA_ATTR_ALLOC_SINGLE_PAGES, &attrs_nohugepage); + vpu->alloc_ctx_vm = vb2_dma_contig_init_ctx_attrs(&pdev->dev, + &attrs_nohugepage); if (IS_ERR(vpu->alloc_ctx_vm)) { ret = PTR_ERR(vpu->alloc_ctx_vm); goto err_dma_contig_vm; -- 2.34.1