On Sun, Jul 21, 2019 at 09:30:10PM -0700, [email protected] wrote:
>               for (i = 0; i < vsg->num_pages; ++i) {
>                       if (NULL != (page = vsg->pages[i])) {
>                               if (!PageReserved(page) && (DMA_FROM_DEVICE == 
> vsg->direction))
> -                                     SetPageDirty(page);
> -                             put_page(page);
> +                                     put_user_pages_dirty(&page, 1);
> +                             else
> +                                     put_user_page(page);
>                       }

Can't just pass a dirty argument to put_user_pages?  Also do we really
need a separate put_user_page for the single page case?
put_user_pages_dirty?

Also the PageReserved check looks bogus, as I can't see how a reserved
page can end up here.  So IMHO the above snippled should really look
something like this:

        put_user_pages(vsg->pages[i], vsg->num_pages,
                        vsg->direction == DMA_FROM_DEVICE);

in the end.

Reply via email to