Define clear_user_highpages() which clears pages sequentially using the single page variant. With !CONFIG_HIGHMEM, pages are contiguous so use the range clearing primitive clear_user_pages(). Signed-off-by: Ankur Arora --- include/linux/highmem.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 6234f316468c..ed609987e24d 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -207,6 +207,24 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr) } #endif +#ifndef clear_user_highpages +static inline void clear_user_highpages(struct page *page, unsigned long vaddr, + unsigned int npages) +{ + if (!IS_ENABLED(CONFIG_HIGHMEM)) { + void *base = page_address(page); + clear_user_pages(base, vaddr, page, npages); + return; + } + + do { + clear_user_highpage(page, vaddr); + vaddr += PAGE_SIZE; + page++; + } while (--npages); +} +#endif + #ifndef vma_alloc_zeroed_movable_folio /** * vma_alloc_zeroed_movable_folio - Allocate a zeroed page for a VMA. -- 2.43.5