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/rsrc: use unpin_user_folio

We want to have a full folio to be left pinned but with only one
reference, for that we "unpin" all but the first page with
unpin_user_pages(), which can be confusing. There is a new helper to
achieve that called unpin_user_folio(), so use that.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://lore.kernel.org/r/e0b2be8f9ea68f6b351ec3bb046f04f437f68491.1745083025.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Pavel Begunkov and committed by
Jens Axboe
ea769256 8a2dacd4

+2 -3
+2 -3
io_uring/rsrc.c
··· 699 699 * The pages are bound to the folio, it doesn't 700 700 * actually unpin them but drops all but one reference, 701 701 * which is usually put down by io_buffer_unmap(). 702 - * Note, needs a better helper. 703 702 */ 704 703 if (data->nr_pages_head > 1) 705 - unpin_user_pages(&page_array[1], data->nr_pages_head - 1); 704 + unpin_user_folio(page_folio(new_array[0]), data->nr_pages_head - 1); 706 705 707 706 j = data->nr_pages_head; 708 707 nr_pages_left -= data->nr_pages_head; ··· 712 713 nr_unpin = min_t(unsigned int, nr_pages_left - 1, 713 714 data->nr_pages_mid - 1); 714 715 if (nr_unpin) 715 - unpin_user_pages(&page_array[j+1], nr_unpin); 716 + unpin_user_folio(page_folio(new_array[i]), nr_unpin); 716 717 j += data->nr_pages_mid; 717 718 nr_pages_left -= data->nr_pages_mid; 718 719 }