Thread (11 messages) 11 messages, 4 authors, 2022-01-26

Re: RFA (Request for Advice): block/bio: get_user_pages() --> pin_user_pages()

From: Jan Kara <jack@suse.cz>
Date: 2022-01-24 22:34:08
Also in: linux-fsdevel

On Mon 24-01-22 13:06:03, John Hubbard wrote:
On 1/24/22 02:05, Jan Kara wrote:
...
quoted
quoted
do_direct_IO()
     dio_zero_block()
         page = ZERO_PAGE(0); <-- This is a problem

I'm not sure what to use, instead of that zero page! The zero page
doesn't need to be allocated nor tracked, and so any replacement
approaches would need either other storage, or some horrid scheme that I
won't go so far as to write on the screen. :)
Well, I'm not sure if you consider this ugly but currently we use
get_page() in that path exactly so that bio_release_pages() does not have
to care about zero page. So now we could grab pin on the zero page instead
through try_grab_page() or something like that...

								Honza
So it sounds like you prefer this over checking for the zero page in
bio_release_pages(). I'll take a look at both ideas, then, and see what
it looks like.
Yes, I somewhat prefer this because it seems more transparent to me.
Furthermore if e.g. we can have zero page mapped to userspace (not sure if
we can for normal mappings but at least for DAX mapping we can), and userspace
provides such mapping as a buffer for direct IO write, then we'll get zero
page attached to bio through iov_iter_get_pages() and we'd have to be very
careful to special-case zero page in iov_iter_get_pages() as well. Overall
it seems fragile to me... So it seems more robust to make sure all pages we
attach to bio are pinned.

								Honza
-- 
Jan Kara [off-list ref]
SUSE Labs, CR
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help