linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFA (Request for Advice): block/bio: get_user_pages() --> pin_user_pages()
@ 2022-01-24  7:52 John Hubbard
  2022-01-24 10:05 ` Jan Kara
  2022-01-24 13:18 ` Matthew Wilcox
  0 siblings, 2 replies; 11+ messages in thread
From: John Hubbard @ 2022-01-24  7:52 UTC (permalink / raw)
  To: Christoph Hellwig, Jan Kara, linux-fsdevel, linux-block

Hi,

Background: despite having very little experience in the block and bio
layers, I am attempting to convert the Direct IO parts of them from
using get_user_pages_fast(), to pin_user_pages_fast(). This requires the
use of a corresponding special release call: unpin_user_pages(), instead
of the generic put_page().

Fortunately, Christoph Hellwig has observed [1] (more than once [2]) that
only "a little" refactoring is required, because it is *almost* true
that bio_release_pages() could just be switched over from calling
put_page(), to unpin_user_page(). The "not quite" part is mainly due to
the zero page. There are a few write paths that pad zeroes, and they use
the zero page.

That's where I'd like some advice. How to refactor things, so that the
zero page does not end up in the list of pages that bio_release_pages()
acts upon?

To ground this in reality, one of the partial call stacks is:

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. :)


[1] https://lore.kernel.org/all/20220120141219.GB11707@lst.de/ (2022)
[2] https://lore.kernel.org/kvm/20190724053053.GA18330@infradead.org/
(2019)


thanks in advance,
-- 
John Hubbard
NVIDIA

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-26  5:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-24  7:52 RFA (Request for Advice): block/bio: get_user_pages() --> pin_user_pages() John Hubbard
2022-01-24 10:05 ` Jan Kara
2022-01-24 10:38   ` Chaitanya Kulkarni
2022-01-24 12:19     ` Jan Kara
2022-01-24 19:34       ` John Hubbard
2022-01-24 21:06         ` Jan Kara
2022-01-24 21:06   ` John Hubbard
2022-01-24 22:17     ` Jan Kara
2022-01-24 13:18 ` Matthew Wilcox
2022-01-24 19:48   ` John Hubbard
2022-01-26  5:42     ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).