Re: [PATCH 1/2] mm/gup.c: fix the wrong comments

From: Matthew Wilcox
Date: Mon Apr 08 2019 - 10:13:26 EST


On Mon, Apr 08, 2019 at 10:37:45AM +0800, Huang Shijie wrote:
> When CONFIG_HAVE_GENERIC_GUP is defined, the kernel will use its own
> get_user_pages_fast().
>
> In the following scenario, we will may meet the bug in the DMA case:
> .....................
> get_user_pages_fast(start,,, pages);
> ......
> sg_alloc_table_from_pages(, pages, ...);
> .....................
>
> The root cause is that sg_alloc_table_from_pages() requires the
> page order to keep the same as it used in the user space, but
> get_user_pages_fast() will mess it up.

I don't understand how get_user_pages_fast() can return the pages in a
different order in the array from the order they appear in userspace.
Can you explain?