From: Andres Freund <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected]
Subject: Re: Deduplicate io_*_prep calls?
Date: Sun, 23 Feb 2020 19:33:52 -0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Hi,
On 2020-02-23 20:17:45 -0700, Jens Axboe wrote:
> > that seems a bit unnecessary. How about breaking that out into a
> > separate function? I can write up a patch, just didn't want to do so if
> > there's a reason for the current split.
> >
> >
> > Alternatively it'd could all be just be dispatches via io_op_defs, but
> > that'd be a bigger change with potential performance implications. And
> > it'd benefit from prior deduplication anyway.
>
> The reason for the split is that if we defer a request, it has to be
> prepared up front. If the request has been deferred, then the
> io_issue_sqe() invocation has sqe == NULL. Hence we only run the prep
> handler once, and read the sqe just once.
> This could of course be compacted with some indirect function calls, but
> I didn't want to pay the overhead of doing so... The downside is that
> the code is a bit bigger.
Shouldn't need indirect function calls? At most the switch() would be
duplicated, if the compiler can't optimize it away (ok, that's an
indirect jump...). I was just thinking of moving the io_*_prep() switch
into something like io_prep_sqe().
io_req_defer_prep() would basically move its switch into io_prep_sqe
(but not touch the rest of its code). io_issue_sqe() would have
if (sqe) {
ret = io_prep_sqe(req, sqe, force_nonblock);
if (ret != 0)
return ret;
}
at the start.
Even if the added switch can't be optimized away from io_issue_sqe(),
the code for all the branches inside the opcode cases isn't free
either...
Greetings,
Andres Freund
next prev parent reply other threads:[~2020-02-24 3:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 1:07 Deduplicate io_*_prep calls? Andres Freund
2020-02-24 3:17 ` Jens Axboe
2020-02-24 3:33 ` Andres Freund [this message]
2020-02-24 3:52 ` Jens Axboe
2020-02-24 7:12 ` Andres Freund
2020-02-24 9:10 ` Pavel Begunkov
2020-02-24 15:40 ` Jens Axboe
2020-02-24 15:44 ` Pavel Begunkov
2020-02-24 15:46 ` Jens Axboe
2020-02-24 15:50 ` Pavel Begunkov
2020-02-24 15:53 ` Jens Axboe
2020-02-24 15:56 ` Pavel Begunkov
2020-02-24 16:02 ` Jens Axboe
2020-02-24 16:18 ` Pavel Begunkov
2020-02-24 17:08 ` Andres Freund
2020-02-24 17:16 ` Pavel Begunkov
2020-02-25 9:26 ` Pavel Begunkov
2020-02-27 21:06 ` Andres Freund
2020-02-24 16:53 ` Andres Freund
2020-02-24 17:19 ` Jens Axboe
2020-02-24 17:30 ` Jens Axboe
2020-02-24 17:37 ` Pavel Begunkov
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] \
/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