Jerome Glisse
2019-Jul-29 20:57 UTC
[PATCH 03/12] block: bio_release_pages: use flags arg instead of bool
On Tue, Jul 23, 2019 at 10:30:53PM -0700, Christoph Hellwig wrote:> On Tue, Jul 23, 2019 at 09:25:09PM -0700, john.hubbard at gmail.com wrote: > > From: John Hubbard <jhubbard at nvidia.com> > > > > In commit d241a95f3514 ("block: optionally mark pages dirty in > > bio_release_pages"), new "bool mark_dirty" argument was added to > > bio_release_pages. > > > > In upcoming work, another bool argument (to indicate that the pages came > > from get_user_pages) is going to be added. That's one bool too many, > > because it's not desirable have calls of the form: > > All pages releases by bio_release_pages should come from > get_get_user_pages, so I don't really see the point here.No they do not all comes from GUP for see various callers of bio_check_pages_dirty() for instance iomap_dio_zero() I have carefully tracked down all this and i did not do anyconvertion just for the fun of it :) Cheers, J?r?me
Christoph Hellwig
2019-Jul-30 10:25 UTC
[PATCH 03/12] block: bio_release_pages: use flags arg instead of bool
On Mon, Jul 29, 2019 at 04:57:21PM -0400, Jerome Glisse wrote:> > All pages releases by bio_release_pages should come from > > get_get_user_pages, so I don't really see the point here. > > No they do not all comes from GUP for see various callers > of bio_check_pages_dirty() for instance iomap_dio_zero() > > I have carefully tracked down all this and i did not do > anyconvertion just for the fun of it :)Well, the point is _should_ not necessarily do. iomap_dio_zero adds the ZERO_PAGE, which we by definition don't need to refcount. So we can mark this bio BIO_NO_PAGE_REF safely after removing the get_page there. Note that the equivalent in the old direct I/O code, dio_refill_pages, will be a little more complicated as it can match user pages and the ZERO_PAGE in a single bio, so a per-bio flag won't handle it easily. Maybe we just need to use a separate bio there as well. In general with series like this we should not encode the status quo an pile new hacks upon the old one, but thing where we should be and fix up the old warts while having to wade through all that code.
Jerome Glisse
2019-Jul-30 15:57 UTC
[PATCH 03/12] block: bio_release_pages: use flags arg instead of bool
On Tue, Jul 30, 2019 at 12:25:57PM +0200, Christoph Hellwig wrote:> On Mon, Jul 29, 2019 at 04:57:21PM -0400, Jerome Glisse wrote: > > > All pages releases by bio_release_pages should come from > > > get_get_user_pages, so I don't really see the point here. > > > > No they do not all comes from GUP for see various callers > > of bio_check_pages_dirty() for instance iomap_dio_zero() > > > > I have carefully tracked down all this and i did not do > > anyconvertion just for the fun of it :) > > Well, the point is _should_ not necessarily do. iomap_dio_zero adds the > ZERO_PAGE, which we by definition don't need to refcount. So we can > mark this bio BIO_NO_PAGE_REF safely after removing the get_page there. > > Note that the equivalent in the old direct I/O code, dio_refill_pages, > will be a little more complicated as it can match user pages and the > ZERO_PAGE in a single bio, so a per-bio flag won't handle it easily. > Maybe we just need to use a separate bio there as well. > > In general with series like this we should not encode the status quo an > pile new hacks upon the old one, but thing where we should be and fix > up the old warts while having to wade through all that code.Other user can also add page that are not coming from GUP but need to have a reference see __blkdev_direct_IO() saddly bio get fill from many different places and not always with GUP. So we can not say that all pages here are coming from bio. I had a different version of the patchset i think that was adding a new release dirty function for GUP versus non GUP bio. I posted it a while ago, i will try to dig it up once i am back. Cheers, J?r?me