lkml.org 
[lkml]   [2023]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Extending page pinning into fs/direct-io.c
On Wed, May 24, 2023 at 09:47:10AM +0100, David Howells wrote:
> True - but I was thinking of just treating the zero_page specially and never
> hold a pin or a ref on it. It can be checked by address, e.g.:
>
> static inline void bio_release_page(struct bio *bio, struct page *page)
> {
> if (page == ZERO_PAGE(0))
> return;
> if (bio_flagged(bio, BIO_PAGE_PINNED))
> unpin_user_page(page);
> else if (bio_flagged(bio, BIO_PAGE_REFFED))
> put_page(page);
> }

That does sound good as well to me.

> I was looking at this:
>
> static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
> {
> ...
> if (dio->is_async && dio_op == REQ_OP_READ && dio->should_dirty)
> bio_set_pages_dirty(bio);
> ...
> }
>
> but looking again, the lock is taken briefly and the dirty bit is set - which
> is reasonable. However, should we be doing it before starting the I/O?

It is done before starting the I/O - the submit_bio is just below this.

\
 
 \ /
  Last update: 2023-05-25 11:53    [W:0.118 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site