[RESEND][PATCH v8 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps

Hillf Danton hdanton at sina.com
Mon Sep 30 08:14:34 UTC 2019


On Fri,  6 Sep 2019 18:47:09 +0000 John Stultz wrote:
> 
> +	cma_pages = cma_alloc(cma_heap->cma, nr_pages, align, false);
> +	if (!cma_pages)
> +		goto free_buf;
> +
> +	if (PageHighMem(cma_pages)) {
> +		unsigned long nr_clear_pages = nr_pages;
> +		struct page *page = cma_pages;
> +
> +		while (nr_clear_pages > 0) {
> +			void *vaddr = kmap_atomic(page);
> +
> +			memset(vaddr, 0, PAGE_SIZE);
> +			kunmap_atomic(vaddr);
> +			page++;
> +			nr_clear_pages--;
> +		}
> +	} else {
> +		memset(page_address(cma_pages), 0, size);
> +	}

Take a breath after zeroing a page, and a peep at pending signal.



More information about the dri-devel mailing list