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

John Stultz john.stultz at linaro.org
Wed Oct 2 16:15:35 UTC 2019


On Mon, Sep 30, 2019 at 1:14 AM Hillf Danton <hdanton at sina.com> wrote:
> 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.

Ok. Took a swing at this. It will be in the next revision.

Thanks again for the review!
-john


More information about the dri-devel mailing list