From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Jooyung Han <jooyung@google.com>,
Mike Snitzer <snitzer@kernel.org>,
zkabelac@redhat.com, dm-devel@lists.linux.dev,
Alasdair Kergon <agk@redhat.com>
Subject: Re: [PATCH V2 5/5] loop: add hint for handling aio via IOCB_NOWAIT
Date: Thu, 20 Mar 2025 15:38:18 +0800 [thread overview]
Message-ID: <Z9vF6vophr8uw66p@fedora> (raw)
In-Reply-To: <20250320072247.GD14337@lst.de>
On Thu, Mar 20, 2025 at 08:22:47AM +0100, Christoph Hellwig wrote:
> On Fri, Mar 14, 2025 at 10:11:45AM +0800, Ming Lei wrote:
> > Add hint for using IOCB_NOWAIT to handle loop aio command for avoiding
> > to cause write(especially randwrite) perf regression on sparse file.
> >
> > Try IOCB_NOWAIT in the following situations:
> >
> > - backing file is block device
>
> Why limit yourself to block devices?
It doesn't limit to block device, just submit NOWAIT unconditionally.
I should have added 'OR' among the three lines.
>
> > - READ aio command
> > - there isn't queued aio non-NOWAIT WRITE, since retry of NOWAIT won't
> > cause contention on WRITE and non-NOWAIT WRITE often implies exclusive
> > lock.
>
> This reads really odd because to me the list implies that you only
> support reads, but the code also supports writes. Maybe try to
> explain this more clearly.
Will improve the comment log.
>
> > With this simple policy, perf regression of randwrte/write on sparse
> > backing file is fixed. Meantime this way addresses perf problem[1] in
> > case of stable FS block mapping via NOWAIT.
>
> This needs to go in with the patch implementing the logic.
OK.
>
> > @@ -70,6 +70,7 @@ struct loop_device {
> > struct rb_root worker_tree;
> > struct timer_list timer;
> > bool sysfs_inited;
> > + unsigned queued_wait_write;
>
> lo_nr_blocking_writes?
>
> What serializes access to this variable?
The write is serialized by the loop spin lock, and the read is done
via READ_ONCE(), since it is just a hint.
>
> > +static inline bool lo_aio_need_try_nowait(struct loop_device *lo,
> > + struct loop_cmd *cmd)
>
> Drop the need_ in the name, it not only is superfluous, but also
> makes it really hard to read the function name.
OK.
Thanks,
Ming
next prev parent reply other threads:[~2025-03-20 7:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 2:11 [PATCH V2 0/5] loop: improve loop aio perf by IOCB_NOWAIT Ming Lei
2025-03-14 2:11 ` [PATCH V2 1/5] loop: simplify do_req_filebacked() Ming Lei
2025-03-20 7:10 ` Christoph Hellwig
2025-03-14 2:11 ` [PATCH V2 2/5] loop: cleanup lo_rw_aio() Ming Lei
2025-03-20 7:11 ` Christoph Hellwig
2025-03-14 2:11 ` [PATCH V2 3/5] loop: move command blkcg/memcg initialization into loop_queue_work Ming Lei
2025-03-20 7:14 ` Christoph Hellwig
2025-03-14 2:11 ` [PATCH V2 4/5] loop: try to handle loop aio command via NOWAIT IO first Ming Lei
2025-03-14 2:11 ` [PATCH V2 5/5] loop: add hint for handling aio via IOCB_NOWAIT Ming Lei
2025-03-20 7:22 ` Christoph Hellwig
2025-03-20 7:38 ` Ming Lei [this message]
2025-03-14 2:16 ` [PATCH V2 0/5] loop: improve loop aio perf by IOCB_NOWAIT Ming Lei
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 \
--in-reply-to=Z9vF6vophr8uw66p@fedora \
--to=ming.lei@redhat.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=hch@lst.de \
--cc=jooyung@google.com \
--cc=linux-block@vger.kernel.org \
--cc=snitzer@kernel.org \
--cc=zkabelac@redhat.com \
/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