lkml.org 
[lkml]   [2019]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 3/5 v2] dma-buf: heaps: Add system heap to dmabuf heaps
> +	i = sg_alloc_table(table, npages, GFP_KERNEL);
> + if (i)
> + goto err1;
> + for_each_sg(table->sgl, sg, table->nents, i) {
> + struct page *page;
> +
> + page = alloc_page(GFP_KERNEL);
> + if (!page)
> + goto err2;
> + sg_set_page(sg, page, PAGE_SIZE, 0);
> + }

Given that one if not the primary intent here is to DMA map the memory
this is a bad idea, as it might require bounce buffering.

What we really want here is something like this:

http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-noncoherent-allocator.3

And I wonder if the S/G building should also move into common code
instead of being duplicated everywhere.

> +static int system_heap_create(void)
> +{
> + struct system_heap *sys_heap;
> +
> + sys_heap = kzalloc(sizeof(*sys_heap), GFP_KERNEL);
> + if (!sys_heap)
> + return -ENOMEM;
> + sys_heap->heap.name = "system_heap";
> + sys_heap->heap.ops = &system_heap_ops;
> +
> + dma_heap_add(&sys_heap->heap);

Why is this dynamically allocated?

\
 
 \ /
  Last update: 2019-03-15 10:08    [W:0.377 / U:0.036 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site