On Tue 06-09-22 00:48:49, Christoph Hellwig wrote: > On Tue, Sep 06, 2022 at 12:44:28AM -0700, John Hubbard wrote: > > OK, that part is clear. > > > > > - for the pin case don't use the existing bvec helper at all, but > > > copy the logic for the block layer for not pinning. > > > > I'm almost, but not quite sure I get the idea above. Overall, what > > happens to bvec pages? Leave the get_page() pin in place for FOLL_GET > > (or USE_FOLL_GET), I suppose, but do...what, for FOLL_PIN callers? > > Do not change anyhing for FOLL_GET callers, as they are on the way out > anyway. > > For FOLL_PIN callers, never pin bvec and kvec pages: For file systems > not acquiring a reference is obviously safe, and the other callers will > need an audit, but I can't think of why it woul ever be unsafe. Are you sure about "For file systems not acquiring a reference is obviously safe"? I can see places e.g. in orangefs, afs, etc. which create bvec iters from pagecache pages. And then we have iter_file_splice_write() which creates bvec from pipe pages (which can also be pagecache pages if vmsplice() is used). So perhaps there are no lifetime issues even without acquiring a reference (but looking at the code I would not say it is obvious) but I definitely don't see how it would be safe to not get a pin to signal to filesystem backing the pagecache page that there is DMA happening to/from the page. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR