public inbox for [email protected]
 help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: io_uring force_nonblock vs POSIX_FADV_WILLNEED
Date: Sat, 1 Feb 2020 23:14:35 -0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Hi,

On 2020-02-01 09:22:45 -0700, Jens Axboe wrote:
> On 2/1/20 2:43 AM, Andres Freund wrote:
> > Seems like either WILLNEED would have to always be deferred, or
> > force_page_cache_readahead, __do_page_cache_readahead would etc need to
> > be wired up to know not to block. Including returning EAGAIN, despite
> > force_page_cache_readahead and generic_readahead() intentially ignoring
> > return values / errors.
> > 
> > I guess it's also possible to just add a separate precheck that looks
> > whether there's any IO needing to be done for the range. That could
> > potentially also be used to make DONTNEED nonblocking in case everything
> > is clean already, which seems like it could be nice. But that seems
> > weird modularity wise.
> 
> Good point, we can block on the read-ahead. Which is counter intuitive,
> but true.

> I'll queue up the below for now, better safe than sorry.
> 
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index fb5c5b3e23f4..1464e4c9b04c 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -2728,8 +2728,7 @@ static int io_fadvise(struct io_kiocb *req, struct io_kiocb **nxt,
>  	struct io_fadvise *fa = &req->fadvise;
>  	int ret;
>  
> -	/* DONTNEED may block, others _should_ not */
> -	if (fa->advice == POSIX_FADV_DONTNEED && force_nonblock)
> +	if (force_nonblock)
>  		return -EAGAIN;
>  
>  	ret = vfs_fadvise(req->file, fa->offset, fa->len, fa->advice);

Hm, that seems a bit broad. It seems fairly safe to leave
POSIX_FADV_{NORMAL,RANDOM,SEQUENTIAL} as sync. I guess there's there's
the argument that that's not something one does frequently enough to
care, but it's not hard to imagine wanting to change to RANDOM for a few
reads and then back to NORMAL.

Greetings,

Andres Freund

  reply	other threads:[~2020-02-02  7:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-01  9:43 io_uring force_nonblock vs POSIX_FADV_WILLNEED Andres Freund
2020-02-01 16:22 ` Jens Axboe
2020-02-02  7:14   ` Andres Freund [this message]
2020-02-02 16:34     ` Jens Axboe
2020-02-03  6:40 ` Matthew Wilcox
2020-02-03  7:42   ` Andres Freund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox