On Fri, Mar 27, 2020 at 07:46:08PM +0100, Alexander Potapenko wrote: > > > Do you mean comparing the address to TASK_SIZE, or is there a more > > > portable way to check that? > > > > !PageHighMem(page) implies the page has a kernel direct mapping. > > I tried adding this check and started seeing false positives because > the virtio_ring driver actually uses highmem pages for DMA, and data > from those pages is later copied to the kernel. > Guess it's easier to just allow handling highmem pages? What problems > do you anticipate? For PageHighMem(page), page_address(page) is not actually valid, so І'm not sure how your code in this patch even worked at all. Note that all drivers (well, except for a few buggy legacy ones with workarounds) can DMA from/to highmem.