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

From: John Stultz
Date: Wed Oct 02 2019 - 12:15:50 EST


On Mon, Sep 30, 2019 at 1:14 AM Hillf Danton <hdanton@xxxxxxxx> 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