Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: use unpin_user_pages() where appropriate

There are a few cases of open-rolled loops around unpin_user_page(), use
the generic helper instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

+3 -6
+1 -3
io_uring/io_uring.c
··· 2630 2630 static void io_pages_free(struct page ***pages, int npages) 2631 2631 { 2632 2632 struct page **page_array = *pages; 2633 - int i; 2634 2633 2635 2634 if (!page_array) 2636 2635 return; 2637 2636 2638 - for (i = 0; i < npages; i++) 2639 - unpin_user_page(page_array[i]); 2637 + unpin_user_pages(page_array, npages); 2640 2638 kvfree(page_array); 2641 2639 *pages = NULL; 2642 2640 }
+2 -3
io_uring/kbuf.c
··· 455 455 struct io_buffer_list *bl) 456 456 { 457 457 struct io_uring_buf_ring *br = NULL; 458 - int nr_pages, ret, i; 459 458 struct page **pages; 459 + int nr_pages, ret; 460 460 461 461 pages = io_pin_pages(reg->ring_addr, 462 462 flex_array_size(br, bufs, reg->ring_entries), ··· 492 492 bl->is_mmap = 0; 493 493 return 0; 494 494 error_unpin: 495 - for (i = 0; i < nr_pages; i++) 496 - unpin_user_page(pages[i]); 495 + unpin_user_pages(pages, nr_pages); 497 496 kvfree(pages); 498 497 vunmap(br); 499 498 return ret;