All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Daniel Ehrenberg <dehrenberg@google.com>
Cc: fio@vger.kernel.org
Subject: Re: [PATCH v2] Adding userspace_libaio_reap option
Date: Tue, 30 Aug 2011 20:47:45 -0600	[thread overview]
Message-ID: <4E5DA0D1.9010600@kernel.dk> (raw)
In-Reply-To: <CAAK6Zt1kz_QXMo7=6+madqa5FSSUxm9U3_wsJV25JY-W70136Q@mail.gmail.com>

On 2011-08-30 19:09, Daniel Ehrenberg wrote:
> On Tue, Aug 30, 2011 at 5:57 PM, Jens Axboe <axboe@kernel.dk> wrote:
>> On 2011-08-30 18:50, Dan Ehrenberg wrote:
>>> @@ -66,7 +107,16 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
>>>       int r, events = 0;
>>>
>>>       do {
>>> -             r = io_getevents(ld->aio_ctx, actual_min, max, ld->aio_events + events, t);
>>> +             if (td->o.userspace_libaio_reap == 1
>>> +                 && actual_min == 0
>>> +                 && ((struct aio_ring *)(ld->aio_ctx))->magic
>>> +                             == AIO_RING_MAGIC) {
>>> +                     r = user_io_getevents(ld->aio_ctx, max,
>>> +                             ld->aio_events + events);
>>> +             } else {
>>> +                     r = io_getevents(ld->aio_ctx, actual_min,
>>> +                             max, ld->aio_events + events, t);
>>> +             }
>>
>> One question here - why depend on actual_min == 0? The check is
>> practically free, would not hurt to do the user_io_getevents() first and
>> punt to io_getevents() afterwards if need be.
> 
> I guess I don't need to depend on that, since you'll never be calling
> both user_io_getevents() and sys_io_getevents() at the same time
> still. It was just paranoia, really--if I'm not grabbing the ring_lock
> spinlock that exists in the kernel, then I'll be really safe if I
> never run code that wants to grab it. But I guess the condition is not
> really necessary since the whole thing is single-threaded.

I think it should be safe.

FWIW, I committed this version, so just base further improves on fio
git. I also half-assed a patch to add the sub-option support, and
converted this one. So you should use

ioengine=libaio:userspace_reap

to set it now. I say half-assed, since it's only really supported for
ioengine at the moment, and it's not included in --cmdhelp output. But
it should work, hopefully.

Please give it a spin :-)

-- 
Jens Axboe


      reply	other threads:[~2011-08-31  2:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31  0:50 [PATCH v2] Adding userspace_libaio_reap option Dan Ehrenberg
2011-08-31  0:57 ` Jens Axboe
2011-08-31  1:09   ` Daniel Ehrenberg
2011-08-31  2:47     ` Jens Axboe [this message]

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=4E5DA0D1.9010600@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=dehrenberg@google.com \
    --cc=fio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.