John Hubbard
2019-Aug-05 22:54 UTC
[PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
On 7/23/19 11:17 PM, Christoph Hellwig wrote:> On Tue, Jul 23, 2019 at 09:25:06PM -0700, john.hubbard at gmail.com wrote: >> * Store, in the iov_iter, a "came from gup (get_user_pages)" parameter. >> Then, use the new iov_iter_get_pages_use_gup() to retrieve it when >> it is time to release the pages. That allows choosing between put_page() >> and put_user_page*(). >> >> * Pass in one more piece of information to bio_release_pages: a "from_gup" >> parameter. Similar use as above. >> >> * Change the block layer, and several file systems, to use >> put_user_page*(). > > I think we can do this in a simple and better way. We have 5 ITER_* > types. Of those ITER_DISCARD as the name suggests never uses pages, so > we can skip handling it. ITER_PIPE is rejected ?n the direct I/O path, > which leaves us with three. >Hi Christoph, Are you working on anything like this? Or on the put_user_bvec() idea? Please let me know, otherwise I'll go in and implement something here. thanks, -- John Hubbard NVIDIA> Out of those ITER_BVEC needs a user page reference, so we want to call > put_user_page* on it. ITER_BVEC always already has page reference, > which means in the block direct I/O path path we alread don't take > a page reference. We should extent that handling to all other calls > of iov_iter_get_pages / iov_iter_get_pages_alloc. I think we should > just reject ITER_KVEC for direct I/O as well as we have no users and > it is rather pointless. Alternatively if we see a use for it the > callers should always have a life page reference anyway (or might > be on kmalloc memory), so we really should not take a reference either. > > In other words: the only time we should ever have to put a page in > this patch is when they are user pages. We'll need to clean up > various bits of code for that, but that can be done gradually before > even getting to the actual put_user_pages conversion. >
Christoph Hellwig
2019-Aug-07 06:34 UTC
[PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
On Mon, Aug 05, 2019 at 03:54:35PM -0700, John Hubbard wrote:> On 7/23/19 11:17 PM, Christoph Hellwig wrote: > > On Tue, Jul 23, 2019 at 09:25:06PM -0700, john.hubbard at gmail.com wrote: > >> * Store, in the iov_iter, a "came from gup (get_user_pages)" parameter. > >> Then, use the new iov_iter_get_pages_use_gup() to retrieve it when > >> it is time to release the pages. That allows choosing between put_page() > >> and put_user_page*(). > >> > >> * Pass in one more piece of information to bio_release_pages: a "from_gup" > >> parameter. Similar use as above. > >> > >> * Change the block layer, and several file systems, to use > >> put_user_page*(). > > > > I think we can do this in a simple and better way. We have 5 ITER_* > > types. Of those ITER_DISCARD as the name suggests never uses pages, so > > we can skip handling it. ITER_PIPE is rejected ?n the direct I/O path, > > which leaves us with three. > > > > Hi Christoph, > > Are you working on anything like this?I was hoping I could steer you towards it. But if you don't want to do it yourself I'll add it to my ever growing todo list.> Or on the put_user_bvec() idea?I have a prototype from two month ago: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/gup-bvec but that only survived the most basic testing, so it'll need more work, which I'm not sure when I'll find time for.
John Hubbard
2019-Aug-07 06:38 UTC
[PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
On 8/6/19 11:34 PM, Christoph Hellwig wrote:> On Mon, Aug 05, 2019 at 03:54:35PM -0700, John Hubbard wrote: >> On 7/23/19 11:17 PM, Christoph Hellwig wrote:...>>> I think we can do this in a simple and better way. We have 5 ITER_* >>> types. Of those ITER_DISCARD as the name suggests never uses pages, so >>> we can skip handling it. ITER_PIPE is rejected ?n the direct I/O path, >>> which leaves us with three. >>> >> >> Hi Christoph, >> >> Are you working on anything like this? > > I was hoping I could steer you towards it. But if you don't want to do > it yourself I'll add it to my ever growing todo list. >Sure, I'm up for this. The bvec-related items are the next logical part of the gup/dma conversions to work on, and I just wanted to avoid solving the same problem if you were already in the code.>> Or on the put_user_bvec() idea? > > I have a prototype from two month ago: > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/gup-bvec > > but that only survived the most basic testing, so it'll need more work, > which I'm not sure when I'll find time for. >I'll take a peek, and probably pester you with a few questions if I get confused. :) thanks, -- John Hubbard NVIDIA
Maybe Matching Threads
- [PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
- [PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
- [PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
- [PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()
- [PATCH 00/12] block/bio, fs: convert put_page() to put_user_page*()