lkml.org 
[lkml]   [2018]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4/9] dma-mapping: move the arm64 ncoherent alloc/free support to common code
    > > +int __init dma_atomic_pool_init(gfp_t gfp, pgprot_t prot)
    > > +{
    > > + unsigned int pool_size_order = get_order(atomic_pool_size);
    > > + unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT;
    > > + struct page *page;
    > > + void *addr;
    > > + int ret;
    > > +
    > > + if (dev_get_cma_area(NULL))
    > > + page = dma_alloc_from_contiguous(NULL, nr_pages,
    > > + pool_size_order, false);
    > > + else
    > > + page = alloc_pages(gfp, pool_size_order);
    > > + if (!page)
    > > + goto out;
    > > +
    > > + memset(page_address(page), 0, atomic_pool_size);
    >
    > Note that this won't work if 'page' is a highmem page - should there
    > be a check for that, or a check for the gfp flags?
    >
    > Also, is this memset() actually useful, or a waste of cycles - when we
    > allocate from this pool (see dma_alloc_from_pool()), we always memset()
    > the buffer.

    Currently there is no user that supports highmem, but yes, the memset
    should probably simply be removed.

    \
     
     \ /
      Last update: 2018-12-04 15:22    [W:3.411 / U:0.960 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site