[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] linux-aio: limit the batch size using `aio-max-batch` pa
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 3/3] linux-aio: limit the batch size using `aio-max-batch` parameter |
Date: |
Tue, 13 Jul 2021 15:58:04 +0100 |
On Wed, Jul 07, 2021 at 05:00:19PM +0200, Stefano Garzarella wrote:
> @@ -371,7 +375,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb
> *laiocb, off_t offset,
> s->io_q.in_queue++;
> if (!s->io_q.blocked &&
> (!s->io_q.plugged ||
> - s->io_q.in_flight + s->io_q.in_queue >= MAX_EVENTS)) {
> + s->io_q.in_queue >= max_batch)) {
Is it safe to drop the MAX_EVENTS case?
Perhaps the following can be used:
int64_t max_batch = s->aio_context->aio_max_batch ?: DEFAULT_MAX_BATCH;
max_batch = MIN_NON_ZERO(MAX_EVENTS - s->io_q.in_flight + s->io_q.in_queue,
max_batch);
Here we'll only need to check against max_batch but it takes into
account MAX_EVENT and in_flight.
Stefan
signature.asc
Description: PGP signature